On Feb 11, 2008, at 10:45 PM, palakolanusrinu wrote:
Its urgent can any one reply plz
palakolanusrinu wrote:
Can any one tell me how to merge two log files using log4j.
I'm getting two log files from two different clients.Now i want to
merge
those two logs into single log file is there any open source is
avilable
to achive this or is there any way to do this?
Thanks in advance
I assume that you want to have the log files sorted on the event
timestamp, otherwise you could just append the two files together.
If you are just dealing with two log files that start with a timestamp
and the timestamp format is compatible with a plain lexical sort, you
could just use the "sort" command that is provided with Unix like
operating systems (or Cygwin for Windows). You'd have to pick out the
where the sortable timestamp field appears in the log files. Then do
something like:
sort --key=10,15 mylog1.log mylog2.log > sorted.log
If the log files are written in XML format, then you could use an XSLT
transform to sort them.
Anything that involves log4j is likely to be more complicated than
just using a generic sort facility on the log files. To use log4j,
you would have to parse the log files back into a LoggingEvent, sort
the LoggingEvent's by timestamp and then output the events into a new
appender.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]