java - log4j with tomcat does not log what is logged in mvn test -
i have web application. when run 'mvn test', logs debug messages console, have configured it. when deploy tomcat, don't see the logs of application. absolutely sure got log4j.properties file on right place in war, when change values in deployed /var/lib/tomcat7/webapps/worldmodel/web-inf/classes/log4j.properties root logger or hibernate , touch web.xml, see/chease see debug logs hibernate. cannot application's debug messages logged configuration i've tried. here how logging:
import org.apache.log4j.level; import org.apache.log4j.logger; logger = logger.getlogger(baseobject.class); log(level.debug,"message");
here log4j.properties testing:
log4j.rootlogger=info, console log4j.appender.console=org.apache.log4j.consoleappender log4j.appender.console.encoding=utf-8 log4j.appender.console.layout = org.apache.log4j.patternlayout log4j.appender.console.layout.conversionpattern = %d [%t] %-5p %c- %m%n log4j.appender.syslog = org.apache.log4j.net.syslogappender log4j.appender.syslog.sysloghost = 127.0.0.1 log4j.appender.syslog.layout = org.apache.log4j.patternlayout log4j.appender.syslog.layout.conversionpattern = %d [%t] %-5p %c- %m%n log4j.appender.syslog.facility = local0 log4j.logger.org.rulez.magwas.worldmodel=debug #log4j.logger.org.hibernate.sql=debug #log4j.logger.org.hibernate.type.descriptor.sql.basicbinder=trace #log4j.logger.org.hibernate.type=trace
here log4j.properties gets deployed:
log4j.rootlogger=info, syslog log4j.appender.syslog = org.apache.log4j.net.syslogappender log4j.appender.syslog.sysloghost = 127.0.0.1 log4j.appender.syslog.layout = org.apache.log4j.patternlayout log4j.appender.syslog.layout.conversionpattern = %d [%t] %-5p %c- %m%n log4j.appender.syslog.facility = local0 log4j.logger.org.rulez.magwas.worldmodel=debug #log4j.logger.org.hibernate.sql=debug #log4j.logger.org.hibernate.type.descriptor.sql.basicbinder=trace #log4j.logger.org.hibernate.type=trace
i such lines in mvn test:
2013-05-21 07:12:17,751 [main] debug org.rulez.magwas.worldmodel.baseobject- setvalue0e9é 072r 074t 0e9é 06bk
the whole project: https://github.com/magwas/worldmodel/commit/c6b08da0a733d9b61257c669e0cc4af9e59444be
edit:
ok, forget it, code (getter , setter methods in bean) seems not being been called, perhaps hibernate sets/gets values directly?
since, you're configuring root logger level info won't display debug level messages.
log4j.rootlogger=info, syslog
the above rootlogger should configured debug see debug , other higher levels (fatal, error, warn , info) in logs.
log4j.rootlogger=debug, syslog
i'm not sure maven test case configuration perhaps log4j.properties
you've shared isn't having effect there.
edit: seems edit logging in production misconfigured. if logging set info should not log debug messages. mean, defeats purpose of having log levels, shows log4j has not been configured , drains prod resources both space , time.
Comments
Post a Comment