我得到了生成日志文件的log4j2.xml。这是配置:
<Configuration status="INFO" advertiser="multicastdns">
<Properties>
<Property name="layout">%d | %-5p | [%t] | %c{2} | %M | %m%n
</Property>
</Properties>
<Appenders>
<RollingFile name="LogFile" fileName="${sys:user.home}/logs/webapp.log"
filePattern="${sys:user.home}/logs/webapp-%d{yyyy-MM-dd}-%i.log"
bufferedIO="false" advertiseURI="file:///C://users/bilguuna/logs/webapp.log"
advertise="true">
<PatternLayout pattern="${layout}" />
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="1 MB" />
</Policies>
<DefaultRolloverStrategy max="10" />
</RollingFile>
</Appenders>
<Loggers>
<Root level="INFO">
<AppenderRef ref="LogFile" level="INFO" />
</Root>
</Loggers>
</Configuration>
我能够使用
查看日志文件浏览器上的文件:/// C://users/bilguuna/logs/webapp.log
。
问题是在ZeroConf选项卡上,我的appender&#34; LogFile&#34;出现连接状态&#34;已连接&#34;。但是,当我双击该行时,它只是改为断开/连接。当我检查Chainsaw-log时。它说Connection拒绝如下图:
我猜是因为Chainsaw选择4555作为我的机器上没有打开的默认端口。那么应该选择哪个端口以及如何在我的log4j2.xml文件中设置它?
由于
更新:在我使用@Scott建议的开发者快照版本后,似乎&#34;连接被拒绝&#34;问题消失了。但我仍然无法看到日志。当我在ZeroConf选项卡上单击条目时,它仍然将连接状态更改为已连接/未连接。这是来自chainsaw-log选项卡的日志:
再次,当我在ZeroConf选项卡上双击条目时,我是否应该看到实际日志? 更新:我的控制台出现以下异常:
WARNING: SocketListener(WS00943.local.).run() exception
java.io.IOException: DNSIncoming corrupted message
at javax.jmdns.impl.DNSIncoming.<init>(DNSIncoming.java:239)
at javax.jmdns.impl.SocketListener.run(SocketListener.java:50)
Caused by: java.lang.IllegalStateException: Can't overwrite cause with java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [javax.jmdns.impl.constants.DNSResultCode]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at java.lang.Throwable.initCause(Unknown Source)
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1344)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1206)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
at javax.jmdns.impl.DNSIncoming.readAnswer(DNSIncoming.java:342)
at javax.jmdns.impl.DNSIncoming.<init>(DNSIncoming.java:229)
... 1 more
Caused by: java.lang.ClassNotFoundException
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1343)
... 5 more
答案 0 :(得分:1)
问题是您需要使用Chainsaw的最新开发人员快照来使用log4j2。 webstart-runnable版本仅适用于log4j1。
开发人员快照位于:http://home.apache.org/~sdeboy/