log4j2 to chainsaw hello world not working... what am I doing wrong? -
i'm trying stream basic hello world log message show in chainsaw log4j2. don't care if uses "zeroconf" or not, want works. know test program logging messages since show on console, , know it's finding config file because can change format of messages printed in console, that's know.
my config file (containing various failed guesses):
<?xml version="1.0" encoding="utf-8"?> <configuration advertiser="org.apache.logging.log4j.core.net.multicastdnsadvertiser"> <appenders> <console name="console" target="system_out"> <patternlayout pattern="%d{hh:mm:ss.sss} [%t] %-5level %logger{36} - %m%n"/> </console> <file name="testfile" filename="logs/test.log" bufferedio="false" advertiseuri="file://localhost/home/matt/code/ade/logs/test.log" advertise="true"> <xmllayout /> </file> <socketappender name="sockettest" host="localhost" immediateflush="true" port="4560" protocol="tcp" advertiseuri="http://localhost" advertise="true"> <xmllayout /> </socketappender> </appenders> <loggers> <root level="trace"> <appender-ref ref="console"/> <appender-ref ref="testfile"/> <appender-ref ref="sockettest"/> </root> </loggers> </configuration> i've tried various combinations of: including jmdns.jar on classpath, restarting chainsaw @ various points, , getting frustrated, nothing has helped.
any ideas?
edit: figured out why couldn't read log files saving disk, (i hadn't been using xmllayout) i've updated question reflect need streaming working.
the 'advertiser' uses log4j2 plugin mechanism, must provide 'name' defined on advertiser in configuration - not fully-qualified class name.
the log4j2 advertisement mechanism supports advertisement of fileappenders , socketappenders. however, chainsaw supports discovery of log4j2 fileappenders advertised patternlayout. xmllayout support show in near future.
the latest developer snapshot of chainsaw must used in order leverage log4j2's advertiser mechanism. chainsaw tarball , dmg available at: http://people.apache.org/~sdeboy/
chainsaw discover advertised fileappender configuration , parse (and tail if latest chainsaw developer build) log file - no chainsaw configuration required.
note, need use patternlayout, , jmdns must on classpath of application using appender configuration.
here example log4j2 -appender- configuration advertise fileappender configuration:
<?xml version="1.0" encoding="utf-8"?> <configuration advertiser="multicastdns"> <appenders> <console name="console" target="system_out"> <patternlayout pattern="%d{hh:mm:ss.sss} [%t] %-5level %logger{36} - %m%n"/> </console> <file name="testfile" filename="logs/test.log" bufferedio="false" advertiseuri="file:///localhost/home/matt/code/ade/logs/test.log" advertise="true"> <patternlayout pattern="%d{hh:mm:ss.sss} [%t] %-5level %logger{36} - %m%n"/> </file> </appenders> <loggers> <root level="trace"> <appender-ref ref="console"/> <appender-ref ref="testfile"/> </root> </loggers> </configuration> once have started app using appender configuration, open 'zeroconf' tab in chainsaw.
you should see row appender's name (assuming added jmdns classpath app using fileappender configuration).
you can click 'autoconnect' if you'd start chainsaw configuration if available.
next, double-click on row appender name , chainsaw start parsing , tailing log file.
the advertised url provided in file appender configuration must accessible network-wise chainsaw (looks working locally chainsaw , fileappender, file:/// paths work fine - note 3 slashes).
chainsaw work best if there delimiters around each field - square brackets, dashes, etc. long character won't present in field delimiting.
Comments
Post a Comment