Now I use the static method to register (because it is very easy for me to log in to Android), but now I need to configure different applications for different classes, so I had a problem with static logging.
And I read Log4J: Strategies for creating Logger instances , I notice that it is time to change the logging strategy, so I will need the following code for my class, which needs a special logger.
private static final Logger logger = Logger.getLogger(XXXX.class);
I feel like this is repetitive work, so are there any ways to avoid adding duplicate code for each individual class or just write less code. Can an AOP or an addiction injection perform such tasks?
I use log4j and Spring, but any other ways to do this would be much appreciated.
java spring dependency-injection logging log4j
Jaskey
source share