Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Reading XML log file generated via Java logging

852668May 11 2012 — edited May 14 2012
Hi,
Sorry if this is the wrong place to post this, but I didn't see a better forum. Our application uses the Java logging system using the XMLFormatter. The application is a server and we have a need for a remote user to examine the logs. The problem is that Java Logging doesn't properly terminate the current log file. When I try to parse the XML log that is currently being written to I get a SAXParseException because the log has the following:
<?xml version="1.0" encoding="windows-1252" standalone="no"?>
<!DOCTYPE log SYSTEM "logger.dtd">
<log>
<record>
  <date>2012-05-11T12:50:50</date>
  <millis>1336755050724</millis>
  <sequence>0</sequence>
  <logger>foo.test.LogXMLReadFile</logger>
  <level>SEVERE</level>
  <class>foo.test.LogXMLReadFile</class>
  <method>doTest</method>
  <thread>1</thread>
  <message>This is the first</message>
</record>
Notice the '</log>' is not there. Java logging adds this once the log file is closed but I need to be able to read it while it is still open.

Thoughts?

Thanks

Edited by: JimM on May 11, 2012 10:13 AM - fixed XML layout
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 11 2012
Added on May 11 2012
11 comments
1,191 views