views:

65

answers:

2

hi,

I'm looking for a java logging framework which enables to declare your own grammar and automatically generates the associated parser.

Ideally, I would like to use log4j and generates a parser and then be able to manipulate these logs as objects.

I've seen there's a scanner generator for log4j based on events but no parser.

I guess they've a parser inside Chainsaw but i wasn't able to find it.

thanks.

+1  A: 

I am not aware of a logging framework like this. If I were doing this, I would setup log4j to log XML or use the built in database appender. From there it would be pretty easy to write a parser to generate objects.

hoffmandirt
I didn't know the DBAppender class. I'm going to use it...thank,
LB
+1  A: 

log4j's LogFilePatternReceiver will convert a text log file into LoggingEvents according to a format you provide, and forward those events to any registered appenders.

You could configure log4j programmatically with the receiver as well as a custom appender (possibly using something similar to VectorAppender here: http://logging.apache.org/log4j/companions/extras/xref-test/org/apache/log4j/VectorAppender.html).

Scott