java - How to disable tomcat server console log? -
my log4j.proerties
log4j.rootlogger=debug,r log4j.appender.r = org.apache.log4j.rollingfileappender log4j.appender.r.file = logs/backup.log log4j.appender.r.append = true log4j.appender.r.datepattern = '.'yyy-mm-dd log4j.appender.r.layout = org.apache.log4j.patternlayout log4j.appender.r.layout.conversionpattern = %d{yyyy-mm-dd hh:mm:ss} %c{1} [%p] %m%n log4j.additivity.info.release.scheduler=false
my action
class is
private static final logger logger = logger.getlogger(logaction.class); if(getuname().equals("admin")&&getpwd().equals("123")) { logger.info("success"); return "su"; } else { addactionmessage("user name , password incorrectly!"); logger.info("failure"); return "fa"; }
my backup.log
file contain following logs. these logs coming tomcat server
a2013-05-24 15:06:44 xmlconfigurationprovider [debug] loading action configurations from: struts-default.xml 2013-05-24 15:06:44 xmlconfigurationprovider [debug] loaded action configuration from: struts-default.xml 2013-05-24 15:06:44 xmlconfigurationprovider [info] parsing configuration file [struts-default.xml] 2013-05-24 15:06:44 xmlconfigurationprovider [debug] loaded type: name:xwork impl:com.opensymphony.xwork2.objectfactory 2013-05-24 15:06:44 xmlconfigurationprovider [debug] loaded type:com.opensymphony.xwork2.objectfactory name:struts
but want following format only
2013-05-24 15:06:44 login successfull. 2013-05-24 15:06:44 login failure.
and question how avoid unwanted logs write log file? , using struts2 , log4j properties.
to turn off unwanted log using log4j configuration properties file via specifying level logger based on logger instantiated given class. example
log4j.logger.org.apache=off,r log4j.logger.com.opensymphony.xwork2=off,r
Comments
Post a Comment