logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Douglas E Wegscheid <Douglas_E_Wegsch...@whirlpool.com>
Subject Re: Extract log info from each output log line on the console
Date Mon, 01 Jun 2009 12:32:38 GMT
if you have a chance to change the log file layout, use the XMLLayout. 
It's unambiguous to parse.

parsing the other layouts can be a problem (think about the situation of 
messages spanning multiple lines, or that have an exception trackback...)

Douglas E Wegscheid
Lead Technical Analyst, Whirlpool Corporation

"A wrong note played hesitatingly is a wrong note. A wrong note played 
with conviction is interpretation."

gamby <gamby1980@libero.it> 
06/01/2009 07:00 AM
Please respond to
"Log4J Users List" <log4j-user@logging.apache.org>


Extract log info from each output log line on the console

Hi all,

I'm developing a tool to do some auto statistics from the generated log of
an app...

I would like to be able to parse each log line generated obviously with 
and extract all the info (timestamp, thread name, message and the others) 
a way that I could process separately those info.
Obviuosly I assume to know the pattern used to produce a log, knowing that
pattern, I would like to extract all the info.

For example if I know that a log file was produced using this pattern --> 
%-5p [%t] - %m%n
Then I would like to extract from the generated log line, the timestamp, 
priority, the thread and the message, but without parsing the raw text 
string indexes for example....

And so the flow should be:
- An application produces some log
- My component read each log line generated and extract all the info, 
on log4j pattern used to produce that log

Any hints?
Thanks in advance
View this message in context: 

Sent from the Log4j - Users mailing list archive at Nabble.com.

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

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message