I start with a new project and do some thoughts on registration. I always used a template in which each class in which logging is performed has its own static logger:
private static final Logger logger = Logger.getLogger(LoggingInterceptor.class);
I do not like this approach, since I have to copy this line to each class where I will write something. I was considering using the Android approach, where there is a log class with its static methods for logging. I began to search the Internet for a similar approach made by someone else, but found nothing.
So my question is: what could be the disatvantages of this approach?
I canβt think of anything, but some advantages, because it follows the DRY-pattern. Different categories can be processed as in Android with "tags", which are parameters of static log methods. For example:
Log.debug(tag, message, exception);
The log class itself will use a common logging structure such as Log4j or even SLF4J.
Therefore, I am interested in your opinions.
java logging
homedom
source share