Ok Scott/All, you got me interested. I downloaded Chainsaw, but the
instructions on creating receivers is almost non-existant. Here's
what I want to do:
1) Run a Java app which creates a log file on a Unix server somewhere.
The Java app does not use log4j to create entries -- its older, and
uses its own internally defined class/methods to create log entries.
2) Run Chainsaw on my local PC in order to look at the log. I'd like
to use the "tail" feature to monitor events as they are being
generated.
What kind of connectivity is used by Chainsaw to montitor a remote
file? Just HTTP? Do I need to NFS?
I tried creating a receiver. It asks for a file name -- but not a UNC
or server name/directory location. How do I specify this information?
TIA!,
-Craig
Hi Craig,
Receivers are new to log4j1.3, which isn't released yet (will be in
alpha soon), but we're using them with Chainsaw). We'll work on
improving the docs.
LogFilePatternReceiver expects a path to look like this:
c:/somepath/somefile.
We're working on adding the ability to process files accessible via
VFS, but that'll be a while before it's available. Right now
LogFilePatternReceiver expects a file path, so you'll probably need to
use NFS for now.
By the way, Chainsaw has built in support for ORO regular expressions
(define a regexp using the LIKE operator). You can also combine
expressions using parentheses and logical operators (&&, ||, !). Just
make sure to put spaces around all operators, operands and
parentheses.
If you have fields in your log file that don't match to log4j's
built-in fields, specify the field(s) in the logFormat as PROP(MYKEY)
for example, and the field will end up in as the 'MYKEY' column in
Chainsaw, which can then be used to filter expressions.
Note that you can specify a filter expression, which can be used to
pre-filter events from being processed by Chainsaw. Leave this param
out if you want to load the entire file.
If possible, specify a logger in the logFormat - it can be used in the
logger tree panel to quickly access events without having to build an
expression rule.
The receiver may not process events if a logger field isn't specified
(I can't recall).
Here's a sample log4j.xml file that can be used as a Chainsaw
configuration file that will process your file's events on Chainsaw's
startup (specify this xml file here: view menu, show application-wide
preferences, automatic configuration.
log4j.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="true">
<plugin name="LogFileReceiver"
class="org.apache.log4j.varia.LogFilePatternReceiver">
<param name="timestampFormat" value="yyyy-MM-d HH:mm:ss,SSS"/>
<param name="logFormat" value="RELATIVETIME [THREAD] LEVEL
LOGGER * - MESSAGE"/>
<param name="fileName" value="c:/test/A4.log"/>
<param name="filterExpression" value="LEVEL > WARN"/>
<param name="tailing" value="true"/>
</plugin>
<root>
<level value="debug"/>
</root>
</log4j:configuration>
I hope this info helps. If you have further questions, let me know.
Scott
sdeboy@apache.org
> Ok Scott/All, you got me interested. I downloaded Chainsaw, but the
> instructions on creating receivers is almost non-existant. Here's
[quoted text clipped - 53 lines]
> > >
> > > Thanks.
Tina - 09 Nov 2005 15:40 GMT
Hi, Scott, I tried to set the Automatic Configuration URL to
file:///C:/chanisaw/log4j.xml
and the log4j.xml is the one you provided here. But when I run chainsaw, the
Receiver's window shows no receivers defined. I right click on the receiver
and choose new receiver, it only gives you option of
MulticastReceiver
SocketHubReceiver
SocketReceiver
UDPReceiver
XMLSpcketReceiver
and no LogFileReceiver displaied. I am using Chainsaw 2.0alpha.
Any idea?
Thanks!
Tina
>Hi Craig,
>
[quoted text clipped - 68 lines]
>> > >
>> > > Thanks.