| Author |
Help with log4j xml output : "log4j:event" is not bound
|
Christopher Whu
Ranch Hand
Joined: Sep 03, 2008
Posts: 80
|
|
I would like to parse my log4j xml output with java (just a fun side project(
a log4j xml file is not proper xml file, it look slike this:
there is no root element, jdom chokes on it telling me
The prefix "log4j" for element "log4j:event" is not bound
i know i can hotwire this and just write a temp file and then parse the temp file. There has to be a simple, better way to do it.
Please advise.
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16487
|
|
The "simpler, better" way is to not produce XML in the first place. Just produce a plain old text log file.
As you note, there is no root element. That's a serious defect for something which claims to produce XML. There's no start tag for the document and no end tag. However if you're committed to parsing the log as XML, your first step is to make it into XML. Put a start tag at the beginning and an end tag at the end, and make the start tag declare the "log4j" prefix with some namespace URI.
You don't need a temporary file for that either. A SequenceInputStream which combines three InputStreams (the start tag, the log data, the end tag) would do just fine.
|
 |
 |
|
|
subject: Help with log4j xml output : "log4j:event" is not bound
|
|
|