I used jmdns 3.4.2 with the latest log4j2 and a sample app that used
the following appender configuration to log to a local file.  Chainsaw
was able to discover the advertisement and live tail the log file.

It looks like the latest JmDNS has changed their API, so log4j2 works
with jmdns 3.4.1, not their latest, right now.

Example appender config:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration  advertiser="multicastdns" status="DEBUG">
  <Appenders>
    <Console name="Console" target="SYSTEM_OUT">
        <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level
%logger{36} - %msg%n"/>
    </Console>
        <File name="File1" fileName="/Users/admin/log4j2-output.log"
bufferedIO="false" advertiseURI="file://Users/admin/log4j2-output.log"
advertise="true">
                <PatternLayout>
                <pattern>%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - 
%m%n</pattern>
        </PatternLayout>
        </File>
  </Appenders>
  <Loggers>
    <Root level="DEBUG">
      <AppenderRef ref="File1"/>
    </Root>
  </Loggers>
</Configuration>

In Chainsaw's 'connect to' menu, I had a 'File1 option'.  I clicked on
it, and a new tab opened with the contents of the file - it's
live-tailing the log file.

On the appender config, advertiseURI could be an ssh endpoint, using
Apache Commons VFS 'sftp' support, instead of a 'file://' URI.  For
example, if you can ssh from your env running Chainsaw to the app
performing the logging, you could use an advertiseURI of something
like:

sftp://username:password@hostname/Users/admin/log4j2-output.log



On 4/18/17, Mohit Garg <mohi...@vt.edu> wrote:
> ---------- Forwarded message ----------
> From: Mohit Garg <mohi...@vt.edu>
> Date: Tue, Apr 18, 2017 at 10:24 PM
> Subject: Chainsaw Zeroconf FileAppender Error
> To: log4j-user@logging.apache.org
>
>
> Hi,
>
> I am using Apache Chainsaw on an Ubuntu 14.04 machine. In my Java
> application I have the advertised my FileAppender URI as follows:
>
> <File name="File1" filename="output.log" bufferedIO="false"
> advertiseURI="file:///path/to/output.log" advertise="true">
>     <PatternLayout pattern="%d %p %c{1.} [%t] %m%n"/>
> </File>
>
> In Zeroconf tab of Chainsaw I can see the Appender File1. However, when i
> try to connect to it I continuously get the following error.
>
> Failed to connect to remote host <the static address of my machine>
> Reconnecting in 3000 ms
>
> ---and so on
>
>
> --
> Thanks and Regards,
> Mohit Garg
>
> Masters|Computer Engineering
> Virginia Polytechnic Institute
> and State University
>
> <+1-540-449-3550>   <https://www.linkedin.com/in/mogarg>
> <https://github.com/mogarg>   <http://bit.ly/mogargcv>
>
>
>
>
> --
> Thanks and Regards,
> Mohit Garg
>
> Masters|Computer Engineering
> Virginia Polytechnic Institute
> and State University
>
> <+1-540-449-3550>   <https://www.linkedin.com/in/mogarg>
> <https://github.com/mogarg>   <http://bit.ly/mogargcv>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to