Logging Log4j2 WildFly 9日志文件为空
我正在研究Wildfly 9/10。 我使用定制的Log4j2配置文件编写了web应用程序Logging Log4j2 WildFly 9日志文件为空,logging,log4j2,wildfly-10,Logging,Log4j2,Wildfly 10,我正在研究Wildfly 9/10。 我使用定制的Log4j2配置文件编写了web应用程序 <configuration status="INFO"> <Appenders> <RollingFile name="General" fileName="D:/logs/general/general.log" filePattern="D:/logs/general/$${date:yyyy-MM}/general-%d{MM-
<configuration status="INFO">
<Appenders>
<RollingFile name="General" fileName="D:/logs/general/general.log"
filePattern="D:/logs/general/$${date:yyyy-MM}/general-%d{MM-dd-yyyy}-%i.log.gz">
<PatternLayout
pattern="%d{ABSOLUTE} %level{length=5} [%thread] %logger{1} - %msg%n" />
<SizeBasedTriggeringPolicy size="20 MB" />
</RollingFile>
<Async name="asyncGeneral" bufferSize="10" includeLocation="true">
<AppenderRef ref="General" />
</Async>
</Appenders>
<Loggers>
<Root level="INFO">
<AppenderRef ref="asyncGeneral" />
</Root>
</Loggers>
但它继续在服务器控制台上打印日志,而文件保持为空
相同的配置在独立应用程序上正常工作。
我错过了什么
更新
部署应用程序时,服务器会打印此调试级别信息:
12:58:17,190 INFO [stdout] (ServerService Thread Pool -- 64) 2016-06-16 12:58:17,190 ServerService Thread Pool -- 64 DEBUG createAppender(={General}, errorRef="null", blocking="true", shutdownTimeout="0", bufferSize="10", name="asyncGeneral", includeLocation="true", Filter=null, Configuration(vfs:/C:/Windows/System32/content/sec-api.war/WEB-INF/lib/com.application.jar/log4j2.xml), ignoreExceptions="true")
12:58:17,194 INFO [stdout] (ServerService Thread Pool -- 64) 2016-06-16 12:58:17,194 ServerService Thread Pool -- 64 DEBUG createAppenders(={Console, RoutingAppender, General,asyncGeneral})
12:58:17,196 INFO [stdout] (ServerService Thread Pool -- 64) 2016-06-16 12:58:17,196 ServerService Thread Pool -- 64 DEBUG reateAppenderRef(ref="asyncGeneral", level="null", Filter=null)
12:58:17,200 INFO [stdout] (ServerService Thread Pool -- 64) 2016-06-16 12:58:17,200 ServerService Thread Pool -- 64 DEBUG createLogger(additivity="null", level="DEBUG", includeLocation="null", ={async, asyncGeneral, asyncDebug}, ={}, Configuration(vfs:/C:/Windows/System32/content/sec-api.war/WEB-INF/lib/com.klopotek.core-1.3.0-SNAPSHOT.jar/log4j2.xml), Filter=null)
12:58:17,225 INFO [stdout] (ServerService Thread Pool -- 64) 2016-06-16 12:58:17,224 ServerService Thread Pool -- 64 DEBUG Registering MBean org.apache.logging.log4j2:type=/sec-api,component=AsyncAppenders,name=asyncGeneral
您的配置仅显示一个RollingFile和异步Appender。然而,日志清楚地显示了控制台和路由附加器。我看到对两个不同配置文件的引用,所以看起来您可能正在使用CompositeConfiguration?在任何情况下,您显示的配置都与日志消息不一致,因此很难说问题出在哪里。您的配置仅显示一个滚动文件和异步追加器。然而,日志清楚地显示了控制台和路由附加器。我看到对两个不同配置文件的引用,所以看起来您可能正在使用CompositeConfiguration?在任何情况下,您显示的配置都与日志消息不一致,因此很难说问题出在哪里。请将状态从“信息”更改为“调试”。然后,我建议创建Jira问题,并将配置文件和日志附加到Jira问题。如果可能的话,提供一个可以运行以重现问题的示例项目会更好。你是说这只是一个bug吗?我在一些帖子中读到,也许有必要排除wildfly标准日志,但我无法用上面的信息判断它是否是一个bug。您可能需要随意配置。如果你这样做了,我想在Log4j网站上记录下来。好的。。。我在上面添加了更多信息。。。关键是wildfly似乎一直在使用它的日志系统,忽略我配置的log4j2。
[stdout]
意味着log4j2正在登录到system.out
。仔细检查部署中是否没有多个配置文件。另外,您希望在文件中看到什么?服务器记录的任何内容(如Hibernate日志)都将无法登录到该文件。请将状态从“信息”更改为“调试”。然后,我建议创建Jira问题,并将配置文件和日志附加到Jira问题。如果可能的话,提供一个可以运行以重现问题的示例项目会更好。你是说这只是一个bug吗?我在一些帖子中读到,也许有必要排除wildfly标准日志,但我无法用上面的信息判断它是否是一个bug。您可能需要随意配置。如果你这样做了,我想在Log4j网站上记录下来。好的。。。我在上面添加了更多信息。。。关键是wildfly似乎一直在使用它的日志系统,忽略我配置的log4j2。[stdout]
意味着log4j2正在登录到system.out
。仔细检查部署中是否没有多个配置文件。另外,您希望在文件中看到什么?服务器记录的任何内容(例如Hibernate日志)都将无法登录到该文件。
12:58:17,190 INFO [stdout] (ServerService Thread Pool -- 64) 2016-06-16 12:58:17,190 ServerService Thread Pool -- 64 DEBUG createAppender(={General}, errorRef="null", blocking="true", shutdownTimeout="0", bufferSize="10", name="asyncGeneral", includeLocation="true", Filter=null, Configuration(vfs:/C:/Windows/System32/content/sec-api.war/WEB-INF/lib/com.application.jar/log4j2.xml), ignoreExceptions="true")
12:58:17,194 INFO [stdout] (ServerService Thread Pool -- 64) 2016-06-16 12:58:17,194 ServerService Thread Pool -- 64 DEBUG createAppenders(={Console, RoutingAppender, General,asyncGeneral})
12:58:17,196 INFO [stdout] (ServerService Thread Pool -- 64) 2016-06-16 12:58:17,196 ServerService Thread Pool -- 64 DEBUG reateAppenderRef(ref="asyncGeneral", level="null", Filter=null)
12:58:17,200 INFO [stdout] (ServerService Thread Pool -- 64) 2016-06-16 12:58:17,200 ServerService Thread Pool -- 64 DEBUG createLogger(additivity="null", level="DEBUG", includeLocation="null", ={async, asyncGeneral, asyncDebug}, ={}, Configuration(vfs:/C:/Windows/System32/content/sec-api.war/WEB-INF/lib/com.klopotek.core-1.3.0-SNAPSHOT.jar/log4j2.xml), Filter=null)
12:58:17,225 INFO [stdout] (ServerService Thread Pool -- 64) 2016-06-16 12:58:17,224 ServerService Thread Pool -- 64 DEBUG Registering MBean org.apache.logging.log4j2:type=/sec-api,component=AsyncAppenders,name=asyncGeneral