How to configure Apache chainsaw for input from multiple devices

I am new to chainsaws and log4j, this is a continuation of the previous post. I have some devices that use socket handlers to send entries to a puzzle using the following configuration file:

<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE log4j:configuration > <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true"> <plugin name="XMLSocketReceiver" class="org.apache.log4j.net.XMLSocketReceiver"> <param name="decoder" value="org.apache.log4j.xml.UtilLoggingXMLDecoder"/> <param name="Port" value="2222"/> </plugin> <appender name="fileAppender" class="org.apache.log4j.RollingFileAppender"> <param name="Threshold" value="INFO" /> <param name="File" value="chainsawtablet.log"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d %-5p [%c{1}] %m %n" /> </layout> </appender> <root> <priority value="debug"/> <appender-ref ref="fileAppender" /> </root> </log4j:configuration> 

The receiver seems to work in that I see a tab in the gui chainsaw with some log entries. but he never writes a log file. maybe he is waiting for a day to go through or something like that. is there any way to do this rollover more often?

The log file does not display entries. Do I need some kind of xml to connect the receiver to the application or is it automatic?

I need log files shared by their source host. Also, if the connection restarts, I would like the log file to capsize.

I would also like to keep log files for several weeks.

I would like to see all the log entries, therefore: param name="Threshold" value="INFO" be ALL instead of INFO ?

How about: priority value="debug" ?

Any pointers would be appreciated.

edit: try a: datePattern value="yyyyMMdd-HHmm" , which supposedly rolls every minute, also does not generate a single log file.

edit the related question and post , also here and there .

+6
source share
1 answer

You do not have log4j binding to Chainsaw. The log messages that you see in the Chainsaw GUI, do they look like internal chainsaw self-starting messages?

You need to configure SocketAppender and associate it with at least one registrar or root registrar. Events from your application will then appear in Chainsaw. If you want to exit the log file, this is another matter, but I assume that you want to use Chainsaw as a real-time graphical display interface, as this is what most people use for it.

Here's the minimum configuration file:

 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/' debug='true'> <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender"> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d %5p %c - %m%n"/> </layout> </appender> <appender name="CHAINSAW" class="org.apache.log4j.net.SocketAppender"> <param name="RemoteHost" value="localhost"/> <param name="Port" value="4445"/> <param name="LocationInfo" value="true"/> </appender> <root> <level value ="debug"/> <appender-ref ref="STDOUT" /> <appender-ref ref="CHAINSAW" /> </root> </log4j:configuration> 
0
source

All Articles