John McGrath [TeamB] Guest
|
Posted: Tue Jul 29, 2003 4:21 am Post subject: Re: Using the new Logging API in java.util.logging |
|
|
On 7/25/2003 at 3:41:23 PM, Michael Walker wrote:
| Quote: | I am trying to understand the Logging API that was implemented in JDK
1.4.x. Does anyone know how to retrieve individual LogRecords from a
specified Logger instance? Can anyone point me to some example(s)
that uses the Logging API?
|
The Logging API is mostly a mechanism for controlling the flow of log
messages, filtering and formatting them, not for persisting them. You
can use it to channel the log messages in the appropriate format to the
appropriate "handler", which displays or persists the log messages.
Typically, you would use the Java Logging API to channel messages to
something like the system event log or to a syslog port, and the log
messages would be stored by those systems. You could just as easily
store the logged messages into a database table.
The Java Logging facility does include handlers for storing the log
messages to a file, a set of rotating files, or to a socket. There are
probably other handlers available somewhere, but I think that is all
that is included out of the box.
You might want to look at the Log4j package, which is part of the
Apache Jakarta project. This performs pretty much the same function as
the Java Logging API, but it is more mature and functional than the
Java Logging API and it works with versions of Java prior to 1.4. It
also comes with a much better selection of handlers, such as one that
saves log messages to the Windows Event log. You can read about Log4j
at http://jakarta.apache.org/log4j.
--
Regards,
John McGrath [TeamB]
|
|