My log4j.properties file -
log4j.rootLogger=INFO, stdout
# =============== console output appender =====================
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %5p: [%c{1}] %m%n
# =================== common logging =========================
# The log level for all classes that are not configured below.
log4j.logger.petascope=INFO
log4j.logger.petascope.wcps=DEBUG
log4j.logger.petascope.wcst=DEBUG
log4j.logger.petascope.wcs=DEBUG
log4j.logger.petascope.wcs2=TRACE
I want to display even DEBUG and TRACE messages on stdout, so I changed the following line
log4j.rootLogger=TRACE, stdout
But I don't see any changes when I view the logs echoes on Tomcat Console, I still see only INFO, WARN ... messages.
Well, even if you have your root logger as TRACE, your log4j.logger.petascope
(pointing to INFO) will override the default root logger's TRACE for petascope.* packages, which is the reason you are not seeing any DEBUG and TRACE.
To keep things simple, try this... set the root logger to trace:-
log4j.rootLogger=TRACE, stdout
Then, comment out the following lines:-
#log4j.logger.petascope=INFO
#log4j.logger.petascope.wcps=DEBUG
#log4j.logger.petascope.wcst=DEBUG
#log4j.logger.petascope.wcs=DEBUG
#log4j.logger.petascope.wcs2=TRACE
Let me know if that works for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With