This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I'm having an issue with Log4j and Aspectj. I've configured logging in my application using Aspects. I have defined pointcuts for all method in my app and before and after advice to log using commons logging. I use log4j as the logging implementation
In the aspect I create the logger
private Log log = LogFactory.getLog("trace");
and in the before and after advise I have simple log statements
I can see that the aspects are executing before and after each method and the debug statements are being executed.
I then config log4j loggers configuration as follows so that the entering & exiting messages only appear in the trace-file appender.
However my debug log statments from the aspectj are not output on the com.myapp logger. If I use log.debug statement anywhere else my app the they are ouput successfully. Also if I change the root logger level to debug the aspectj log statements are output to my appenders.
What I can't understand is why the log statements from the aspects are not output on my custom logger.