aspose file tools
The moose likes XML and Related Technologies and the fly likes Help with log4j xml output  :   Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "Help with log4j xml output  :   "log4j:event" is not bound " Watch "Help with log4j xml output  :   "log4j:event" is not bound " New topic
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
    
    2

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help with log4j xml output : "log4j:event" is not bound
 
Similar Threads
log4j - creating my own file
JNDI Port number issue while strating JBoss server 4.2.2.GA
Tomcat error when running startup.sh
Security Contraints setup..
Log4j XMLLayout