log4j-struts2实践

来源:互联网 发布:软件陷阱技术 编辑:程序博客网 时间:2024/05/17 21:56

感谢博主 谢谢 再谢 thank you too

懂行的人都知道,log4j日志是个很基础的东东,与struts这种高层框架无关,只与web开发了的tomcat有关。这里之所以写出struts,是因为笔者一开始用struts的时候,以为是这样,也是这样google的。好了,言归正传,开工了





log4j.properties的内容为:


log4j.projectName=log4j-test-webapplog4j.rootLogger=INFO,stdout,FILElog4j.appender.stdout=org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.Target=System.outlog4j.appender.stdout.layout=org.apache.log4j.PatternLayoutlog4j.appender.stdout=org.apache.log4j.DailyRollingFileAppenderlog4j.appender.stdout.layout.ConversionPattern=%d %5p (%c:%L) - %m%nlog4j.logger.noModule=FATALlog4j.logger.com.opensymphony.xwork2=DEBUGlog4j.logger.org.apache.struts2=DEBUG# define the appenderlog4j.appender.FILE=org.apache.log4j.FileAppenderlog4j.appender.FILE.File=${catalina.home}/logs/${log4j.projectName}.log# define the layoutlog4j.appender.FILE.layout=org.apache.log4j.PatternLayoutlog4j.appender.FILE.layout.conversionPattern=%d %5p (%c:%L) - %m%n                                                                                        

在tomcate中你会发现:


0 0
原创粉丝点击