I would either use Chaisaw II [1] or look at the code it uses to read log
files. It can read XML formatted files as well as regular log files, as long
as you give it the pattern the log was written in. See the
LogFilePatternReciever [2]. Chainsaw can even read a remote file using the
VFSLogFilePatternReciever [3], so I would suggest using the tool rather than
writing the app yourself unless you have very unique requirements.
[1] http://logging.apache.org/chainsaw/index.html
[2]
http://logging.apache.org/log4j/companions/receivers/apidocs/org/apache/log4j/varia/LogFilePatternReceiver.html
[3]
http://logging.apache.org/chainsaw/apidocs/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.html
Jake
On Tue, 27 Apr 2010 17:57:43 +0530
Prashant Patil <[email protected]> wrote:
Hi Douglas,
Thanks for the response.
But the problem with that approach is that there are n number of log files
already exist. And those are not in XMLLayout.
So This approach wouldn't be useful here.
Please let me know if any other efficient solution for this.
regards,
Prashant
-----Original Message-----
From: Douglas E Wegscheid [mailto:[email protected]]
Sent: Tuesday, April 27, 2010 5:22 PM
To: Log4J Users List
Cc: [email protected]
Subject: Re: FW: Parsing Log4j log file
one approach, use the XmlLayout, and then you can use your favorite XML
parsing API to parse the file.
Douglas E Wegscheid
Lead Technical Analyst, Whirlpool Corporation
(269)-923-5278
"A wrong note played hesitatingly is a wrong note. A wrong note played
with conviction is interpretation."
Prashant Patil <[email protected]>
04/27/2010 05:56 AM
Please respond to
"Log4J Users List" <[email protected]>
To
"[email protected]" <[email protected]>
cc
Subject
FW: Parsing Log4j log file
Hi,
I want to read the log4j log file in my program and want to search some
information from the log file.
If there is any API available for log file parsing/reading, Please let me
know.
regards,
Prashant
DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is
the property of Persistent Systems Ltd. It is intended only for the use of
the individual or entity to which it is addressed. If you are not the
intended recipient, you are not authorized to read, retain, copy, print,
distribute or use this message. If you have received this communication in
error, please notify the sender and delete all copies of this message.
Persistent Systems Ltd. does not accept any liability for virus infected
mails.
DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the
property of Persistent Systems Ltd. It is intended only for the use of the
individual or entity to which it is addressed. If you are not the intended
recipient, you are not authorized to read, retain, copy, print, distribute or
use this message. If you have received this communication in error, please
notify the sender and delete all copies of this message. Persistent Systems
Ltd. does not accept any liability for virus infected mails.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]