log4j 日志打印2遍
日志如下:
[INFO] org.springframework.web.context.ContextLoader,2016-07-26 19:22:29,865,Root WebApplicationContext: initialization started
[INFO] org.springframework.web.context.ContextLoader,2016-07-26 19:22:29,865,Root WebApplicationContext: initialization started
[DEBUG] org.springframework.web.context.support.StandardServletEnvironment,2016-07-26 19:22:30,141,Initializing new StandardServletEnvironment
[DEBUG] org.springframework.web.context.support.StandardServletEnvironment,2016-07-26 19:22:30,141,Initializing new StandardServletEnvironment
[DEBUG] org.springframework.web.context.support.StandardServletEnvironment,2016-07-26 19:22:30,144,Adding [servletConfigInitParams] PropertySource with lowest search precedence
[DEBUG] org.springframework.web.context.support.StandardServletEnvironment,2016-07-26 19:22:30,144,Adding [servletConfigInitParams] PropertySource with lowest search precedence
[DEBUG] org.springframework.web.context.support.StandardServletEnvironment,2016-07-26 19:22:30,145,Adding [servletContextInitParams] PropertySource with lowest search precedence
[DEBUG] org.springframework.web.context.support.StandardServletEnvironment,2016-07-26 19:22:30,145,Adding [servletContextInitParams] PropertySource with lowest search precedence
[DEBUG] org.springframework.web.context.support.StandardServletEnvironment,2016-07-26 19:22:30,160,Adding [jndiProperties] PropertySource with lowest search precedence
[DEBUG] org.springframework.web.context.support.StandardServletEnvironment,2016-07-26 19:22:30,160,Adding [jndiProperties] PropertySource with lowest search precedence
[DEBUG] org.springframework.web.context.support.StandardServletEnvironment,2016-07-26 19:22:30,161,Adding [systemProperties] PropertySource with lowest search precedence
[DEBUG] org.springframework.web.context.support.StandardServletEnvironment,2016-07-26 19:22:30,161,Adding [systemProperties] PropertySource with lowest search precedence
[DEBUG] org.springframework.web.context.support.StandardServletEnvironment,2016-07-26 19:22:30,161,Adding [systemEnvironment] PropertySource with lowest search precedence
[DEBUG] org.springframework.web.context.support.StandardServletEnvironment,2016-07-26 19:22:30,161,Adding [systemEnvironment] PropertySource with lowest search precedence
全部输出2次,感觉像是项目启动了2次一样.
log4j.xml配置如下:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%p] %c,%d{yyyy-MM-dd HH
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
引用来自“小王爷威武”的评论
因为配置了这一段:
所以
org.springframework.web.context.ContextLoader就打印了日志。
而且还配置了additivity="true",所以还会找上一级日志:org.springframework.web.context,
没有的话,再找org.springframework.web,依此类推,找到org都没有,再往上找就是root了。
root你已经配置了,所以又打印了
因为配置了这一段:
所以
org.springframework.web.context.ContextLoader就打印了日志。
而且还配置了additivity="true",所以还会找上一级日志:org.springframework.web.context,
没有的话,再找org.springframework.web,依此类推,找到org都没有,再往上找就是root了。
root你已经配置了,所以又打印了