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: FillePatternReciever
Date Wed, 02 Jul 2008 18:37:13 GMT
There are a couple of issues:

The file-load xml file is really to load a text file with events formatted using Log4j's XMLLayout,
not a plain text file like what you have.

To load the events you have, you want to go to the view-show application wide preferences
menu, and enter the -URL- to the log4j xml configuration file into the 'Automatic Configuration
URL' field (on windows, something like this: (file:///c:/fakeevents.xml)

You have a few options to get your java.util.logging-created files to display events correctly
in Chainsaw (and tailed)
 - Use a XMLSocketReceiver on the log4j side and a SocketHandler on the java.util.logging
side (XMLSocketReceiver needs to have the 'decoder' param set to "org.apache.log4j.xml.UtilLoggingXMLDecoder")
 - Use a LogFileXMLReceiver (decoder param must be set there as well) (tailing seems to only
work on windows using a file:// url)

The file-load remote java util file won't tail but will load java.util.logging files saved
in java.util.logging's XML format.

I'm not sure if LogFileXMLReceiver is in the Web Start-available version of Chainsaw - you
might have to build it yourself to get that one..

Hope that helps

Scott Deboy
COMOTIV SYSTEMS
111 SW Columbia Street Ste. 950
Portland, OR  97201

Telephone:      503.224.7496
Cell:           503.997.1367
Fax:            503.222.0185

sdeboy@comotivsystems.com

www.comotivsystems.com



-----Original Message-----
From: Shriver, Daniel [mailto:dshriver@mitre.org]
Sent: Wed 7/2/2008 10:20 AM
To: Log4J Users List
Subject: RE: FillePatternReciever
 
I wish I'd looked at SimpleDateFormat for the date syntax first!

I'm still getting "Loaded 0 events."  I am probably loading it wrong.
I launch chainsaw, then from the file menu I choose to load the xml
config file.  I'm assuming that (given how the config file specifies
the log file to look at) chainsaw then turns around and automatically
loads the indicated log file.

Chainsaw's xterm says this when I load the config file:

  [AWT-EventQueue-0] INFO org.apache.log4j.chainsaw.LoadXMLAction -
load file called
  [AWT-EventQueue-0] INFO org.apache.log4j.chainsaw.LoadXMLAction -
Need to load a file
  [AWT-EventQueue-0] INFO org.apache.log4j.chainsaw.LoadXMLAction -
loading the contents of
    /devel/scengen/dshriver/EXAMPLE.chainsaw.prop.xml

I may have some trouble with this WARN - WARNING business.  The output
log file is from java utils logging (not log4j)- which is why I'm
bothering with this LogFile... business to begin with.  I want to get
that logging info in real time along with the log4j stuff (our app uses
log4j, but relies on internal libraries which use java utils logging)n.
Would "LEVEL*:" work- or does "*" in these patterns always mean a word
with length > 0.

Perhaps the problem is my version of chainsaw.  I'm using
log4j-1.2.16-SNAPSHOT.jar.

Thanks again

-----Original Message-----
From: Scott Deboy [mailto:sdeboy@comotivsystems.com] 
Sent: Wednesday, July 02, 2008 12:17 PM
To: Log4J Users List
Subject: RE: FillePatternReciever

I was able to convert the events below with the included configuration.

Jul 2, 2008 11:40:10 AM <<fully-qualified-class-name>> <clinit> INFO:
Setting debug level to INFO
Jul 2, 2008 11:40:10 AM <<fully-qualified-class-name>>
addDefaultProperty WARNING: nas.nfdc.ascii.basedir default already set
by: <<file-with-path>> which probably means it's being defined twice,
which isbad!!

---------------
config:

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="true">
  <plugin name="fileReceiver"
class="org.apache.log4j.varia.LogFilePatternReceiver">
  <param name="fileURL" value="file:/fakeevents.log"/>
  <param name="timestampFormat" value="MMM d, yyyy h:mm:ss a"/>
  <param name="logFormat" value="TIMESTAMP CLASS * LEVEL: MESSAGE"/>
  <param name="name" value="testLog"/>
  <param name="tailing" value="true"/>
  </plugin>

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


A few things to keep in mind: 
 - logFilePatternReceiver's timestamp format relies on SimpleDateFormat
patterns
 - the pattern in the configuration assumes 1-hour times appear as
single digits (8, not 08 for the hour)
 - any character you put in your timestamp format or log format HAS to
exist in your log file (spaces and delimiters)
 - chainsaw doesn't recognize 'WARNING' severity (it recognizes 'WARN')
- it'll show up as DEBUG in the logs
 - newlines can be used in log message text


Scott Deboy
COMOTIV SYSTEMS
111 SW Columbia Street Ste. 950
Portland, OR  97201

Telephone:      503.224.7496
Cell:           503.997.1367
Fax:            503.222.0185

sdeboy@comotivsystems.com

www.comotivsystems.com



-----Original Message-----
From: Shriver, Daniel [mailto:dshriver@mitre.org]
Sent: Wed 7/2/2008 8:18 AM
To: Log4J Users List
Subject: FillePatternReciever
 
I'm looking at local documentation for LogFilePatternReciever and am
still confused on configuring it.

I have a log file with lines like:

  Jul 2, 2008 11:40:10 AM <<fully-qualified-class-name>> <clinit> INFO:
Setting debug level to INFO
  Jul 2, 2008 11:40:10 AM <<fully-qualified-class-name>>
addDefaultProperty
  WARNING: nas.nfdc.ascii.basedir default already set by:
<<file-with-path>> which probably means it's being
    defined twice, which isbad!!

(I've blanked out fully-qualified-class-name and file-with-path, just
to make sure I'm not releasing anything I'm not supposed to)

So I have a receiver config:

  <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="true">
  <plugin name="fileReceiver"
class="org.apache.log4j.varia.LogFilePatternReceiver">
  <param name="fileURL" value="file:/devel/scengen/dshriver/ATMM.log"/>
  <param name="timestampFormat" value="mmm dd, yyyy II:MM:SS p"/>
  <param name="logFormat" value="TIMESTAMP CLASS * LEVEL: MESSAGE"/>
  <param name="name" value="testLog"/>
  <param name="tailing" value="true"/>
  </plugin>

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

When I ask chainsaw to load this file a dialog pops up saying "Loaded 0
events." (even though the file pointed to in the config file by fileURL
has multiple lines in it (the two at top are some example lines from
it)).

I suspect my timestampFormat is off, I've tried tweaking it several
times (modeling it after 'C's time notation) but still get nothing
loaded in by chainsaw.


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




---------------------------------------------------------------------
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