Java Logging API
The Java Logging API is part the J2SE API Specification an overview of the key elements of this API is available.
Integrating Java Logs in a Forrest Site
If you have the log file available, simply place it in your projects xdoc directory and link to it as normal. For example, the following file is stored within this projects xdocs directory in a samples subfolder.
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE log SYSTEM "logger.dtd"> <log> <record> <date>2000-08-23 19:21:05</date> <millis>967083665789</millis> <sequence>1256</sequence> <logger>kgh.test.fred</logger> <level>INFO</level> <class>kgh.test.XMLTest</class> <method>writeLog</method> <thread>10</thread> <message>Hello world!</message> </record> <record> <date>2000-08-23 19:21:10</date> <millis>967083665789</millis> <sequence>1265</sequence> <logger>kgh.test.fred</logger> <level>INFO</level> <class>kgh.test.XMLTest</class> <method>writeLog</method> <thread>10</thread> <message>I'm the third log message (but recorded second in the file)</message> </record> <record> <date>2000-08-23 19:21:06</date> <millis>967083665789</millis> <sequence>1260</sequence> <logger>kgh.test.fred</logger> <level>INFO</level> <class>kgh.test.XMLTest</class> <method>writeLog</method> <thread>10</thread> <message>This is the second log message in terms of time, but the third in the log file.</message> </record> <record> <date>2000-08-23 19:21:15</date> <millis>967083665789</millis> <sequence>1270</sequence> <logger>kgh.test.fred</logger> <level>INFO</level> <class>kgh.test.XMLTest</class> <method>destroy</method> <thread>10</thread> <message>Goodbye world!</message> </record> </log>
To view this document as an HTML page you would use the following link <a href="samples/javaLogAPI.html>.
If the log file is not available to you, but instead is available at a given URL then you need to tell the plugin where to find the log file, it will then retrieve the file and include it as if it were local. To do this you make a request the URL /do/view/log.FORMAT, where FORMAT is any extension that your Forrest project recognises (e.g. html, pdf etc). In addition you need to pass some parameters in the URL so that the plugin can find your log file:
Parameter | Description |
---|---|
location | The location of the log file |
protocol | The protocol to use when retrieving the log file |
For example, to retrieve a log file from a location on your local hard drive you would construct an URL something like this (to view the html page):
<a href="/do/view/log.html?protocol=file&location=path\to\file\file.log">View Log</>
or to view the PDF version of the log file:
<a href="/do/view/log.pdf?protocol=file&location=path\to\file\file.log">View Log</>