Hello, As per my requirement, I need to use something like MyAppLogger in all my class to get log4j logger. As suggested in log4j Complete manual, I decided to use Wrapper class to get log4j Logger. Please look at my Wrapper class below.
Now, the next requirement is to prefix "Timestamp, threadId, Class name, Method name" to the actual log message. I configured PatternLayout in log4j.xml config file as mentioned below
This is my logger
test class:
The output is below:
The result is expected to show up Class name and method name where logging message is created. But what happens here is, as I use logger wrapper, the class name and method name is always com.logger.test.MyAppLogger.debug/info/warn/error. This is not the behavior which I need. How could I correct ? Should I remove wrapper and extend log4j Logger class? What would be the best approach? Please advise me.