1

I got log4j2.xml that generates log files. Here is the config:

<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>

I'm able to see a log file using

file:///C://users/bilguuna/logs/webapp.log

on the browser.

A problem is that on the ZeroConf tab, my appender "LogFile" is appeared with Connection status "Connected". But when I double click on that row, it's just changed to disconnected/connected. When I check Chainsaw-log. It said that Connection refused as image below: enter image description here

I guess it's because of that Chainsaw chooses 4555 as a default port which is not open on my machine. So what port should choose and how to set it in my log4j2.xml file?

Thanks

UPDATE: After I used the developer snapshot version as @Scott suggested, it seems like "connection refused" problem went away. But still I can't see the logs. When I click on entry at ZeroConf tab, it still changes the Connection Status to Connected/Not Connected. Here is the log from chainsaw-log tab: enter image description here

Again, was I supposed to see the actual logs when I double click on entry at ZeroConf tab? Update: I got following exception on my console:

 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
Bilguun
  • 130
  • 1
  • 12

1 Answers1

1

The problem is you need to use the latest developer snapshot of Chainsaw to work with log4j2. The webstart-runnable version works only with log4j1.

Developer snapshot is available at: http://home.apache.org/~sdeboy/

Scott
  • 1,728
  • 11
  • 11
  • Thank you Scott, I've used the developer snapshot but still no luck. I've updated my question. If you see the image from the updated question. WS00943 is my machine's local domain, smdi.com is network's domain, 10.20.91.29 is my machine's ip address. It seems like it's trying to connect to WS00943.smdi.com/10.20.91.29:4555. Is that the way it supposed to be? – Bilguun Mar 07 '16 at 15:51