logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Deboy" <sde...@comotivsystems.com>
Subject RE: Chainsaw Configuration
Date Fri, 04 Mar 2005 05:28:35 GMT
Chainsaw can process events from multiple log files.

Chainsaw requires its own configuration file that provide receiver definitions - separate
from the config files that provide appender definitions.

To process multiple log files, create multiple 'plugin' sections in Chainsaw's config file
- one for each log file you'd like to receive.  I've included an example below.

In the example below, if your log file doesn't contain a timestamp field, it doesn't matter
what the timestampFormat field in the logFilePatternReceiver configuration contains.  With
a simple layout, that's the case - simple layout only provides LEVEL, a dash, and the message.

To take advantage of Chainsaw's features, you may want to change the file appender layouts
to include a logger (use PatternLayout).

I've included below an example config file demonstrating how to create a chainsaw config file
that processes events from 3 log files..

Save this file with any name you'd like, and in Chainsaw's application-wide prefs screen,
set the 'configuration URL' field to the url pointing to this file.  For example, save the
file as chainsaw-config.xml on the root of your C drive, and set the 'configuration URL' field
to 'file:///c:/chainsaw-config.xml' (minus the single quotes)

Notice in the log file that the only difference is the value of the 'fileURL' param.  Also
notice there are no appenders defined - only receivers.  If you used different layouts for
the different log files, you must modify the logFormat param for the associated receiver to
match the layout provided by the appender.

chainsaw-config.xml
---------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration >
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true">

 <plugin name="LogFileReceiver"
class="org.apache.log4j.varia.LogFilePatternReceiver">
     <param name="fileURL" value="file:///c:/Nexus/Home/Cimulate/Prototype/Chainsaw.log"/>
     <param name="timestampFormat" value="yyyy-MM-dd HH:mm:ss,SSS"/>
     <param name="logFormat" value="LEVEL - MESSAGE"/>
     <param name="name" value="sampleLogFileReceiver"/>
     <param name="tailing" value="true"/>
   </plugin>

 <plugin name="LogFileReceiver"
class="org.apache.log4j.varia.LogFilePatternReceiver">
     <param name="fileURL" value="file:///c:/Nexus/Home/Cimulate/Prototype/Chainsaw2.log"/>
     <param name="timestampFormat" value="yyyy-MM-dd HH:mm:ss,SSS"/>
     <param name="logFormat" value="LEVEL - MESSAGE"/>
     <param name="name" value="sampleLogFileReceiver"/>
     <param name="tailing" value="true"/>
   </plugin>

 <plugin name="LogFileReceiver"
class="org.apache.log4j.varia.LogFilePatternReceiver">
     <param name="fileURL" value="file:///c:/Nexus/Home/Cimulate/Prototype/Chainsaw3.log"/>
     <param name="timestampFormat" value="yyyy-MM-dd HH:mm:ss,SSS"/>
     <param name="logFormat" value="LEVEL - MESSAGE"/>
     <param name="name" value="sampleLogFileReceiver"/>
     <param name="tailing" value="true"/>
   </plugin>

   <root>
      <level value="debug"/>
   </root>
</log4j:configuration>

-----------------
Hope this helps -

Once you have this working, you can change the application-wide prefs - tab identifier - field
to change the way events are routed (possibly aggregating the events from the different log
files into a single tab)

If you have more questions, let us know

Scott



-----Original Message-----
From:   Robert Vaessen [mailto:robert.vaessen@intepoint.com]
Sent:   Thu 3/3/2005 5:55 PM
To:     'Log4J Users List'
Cc:    
Subject:        RE: Chainsaw Configuration
I am using Chainsaw to log events from an application whose processing
is distributed across a mix of java and .net processes. Currently, each
of these processes is producing a log file via a RollingFileAppender. I
am considering that it might be nice to have a single file that
aggregates the output from all of the application's components just as
is happening on the Chainsaw Logging Panel. So:
        1) Your reply indicates that this can be done but it isn't
working for me (see my Config file with the previous post).
        2) If you think that this is a bad idea then I'd really like to
have the benefit of your thoughts.

Best Regards,
Robert

-----Original Message-----
From: Scott Deboy [mailto:sdeboy@comotivsystems.com]
Sent: Thursday, March 03, 2005 1:24 PM
To: Log4J Users List
Subject: RE: Chainsaw Configuration

If your Chainsaw config file includes an appender, the appender will
process events received by Chainsaw (for example, a fileAppender hooked
up to Chainsaw would write any events received by Chainsaw to the log
file, and you probably don't want that to happen)..

For Chainsaw to read log files, you need to add a LogFilePatternReceiver
to the config file.

Here's the example from the sample config:

 <plugin name="LogFileReceiver"
class="org.apache.log4j.varia.LogFilePatternReceiver">
     <param name="fileURL" value="file:///c:/sample.log"/>
     <param name="timestampFormat" value="yyyy-MM-dd HH:mm:ss,SSS"/>
     <param name="logFormat" value="TIMESTAMP LEVEL [LOGGER] MESSAGE"/>
     <param name="name" value="sampleLogFileReceiver"/>
     <param name="tailing" value="true"/>
   </plugin>

Chainsaw's config file can have any name, it just needs to be accessible
as a URL (and specified as a URL in the application-wide preferences
screen)

Scott

-----Original Message-----
From:   Robert Vaessen [mailto:robert.vaessen@intepoint.com]
Sent:   Thu 3/3/2005 9:57 AM
To:     'Log4J Users List'
Cc:   
Subject:        RE: Chainsaw Configuration
Hello Dirk,

        Thank you very much. I am a bit embarrassed that I didn't notice
that on my own.

        Do you have any comments on the second part of my question
(configuring Chainsaw to use a Rolling File Appender)? It doesn't seem
to be working for me. I've pasted in my config file below.

Robert

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="true">

<plugin name="UDPReceiver" class="org.apache.log4j.net.UDPReceiver">
  <param name="Port" value="4446"/>
</plugin>

<plugin name="SocketReceiver"
class="org.apache.log4j.net.SocketReceiver">
  <param name="Port" value="4560"/>
</plugin>

<appender name="RollingFile"
class="org.apache.log4j.RollingFileAppender">
  <param name="File"
value="C:/Nexus/Home/Cimulate/Prototype/Chainsaw.log"/>
  <param name="Append" value="true"/>
  <param name="MaxFileSize" value="100KB"/>
  <param name="maxBackupIndex" value="2"/>
  <layout class="org.apache.log4j.SimpleLayout"/>
/appender>
 
<root>
  <priority value="debug"/>
  <appender-ref ref="RollingFile"/>
/root>

      

</log4j:configuration>

-----Original Message-----
From: OOMS DIRK [mailto:Ext.Dirk.Ooms@siemens.be]
Sent: Thursday, March 03, 2005 11:13 AM
To: 'Log4J Users List'
Subject: RE: Chainsaw Configuration

At the moment you can not specify this "plugin config" as a System
Property,
but you can specify it via the menu "Show Application wide preferences"
and
then "Automatic Configuration URL" (in fact this info is stored in the
file
chainsaw.settings.properties as configurationURL). You can specify this
url
using file, http or ftp.

dirk

> -----Original Message-----
> From: Robert Vaessen [mailto:robert.vaessen@intepoint.com]
> Sent: donderdag 3 maart 2005 17:07
> To: log4j-user@logging.apache.org
> Subject: Chainsaw Configuration
>
>
> Hello,
>
>
>
>             I am currently configuring my Chainsaw receivers via the
> "You have no Receivers defined." dialog that pops up when Chainsaw
> starts. I have seen the "example Receiver configuration" on Chainsaw's
> Welcome tab and from it infer that I can place a configuration file
> somewhere and have Chainsaw load it. But, try as I may, I cannot
> discover how to do this. I know how to do it with Log4j, but I am
> confused with regards to system options and class paths when
> it comes to
> Java Web Start (which is how I am running Chainsaw).
>
>
>
>             So, my questions are:
>
>
>
>             1) With what name and in what location can I create a
> Chainsaw configuration file?
>
>             2) Can I, as the example implies, configure Chainsaw's
> internal logging system via this file? More specifically, can I
> configure a Rolling File Appender that aggregates the logging events
> from all of my remote appenders.
>
>
>
>             Thank you for your time and consideration.
>
>
>
> Best Regards,
>
> Robert Vaessen
>
>

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



Mime
View raw message