Package de.mnl.osgi.osgi2jul
A bundle that forwards events from the OSGi logging service
to java.util.logging (JUL).
Installation
The bundle is deployed as any other OSGi bundleForwarding functionality
The bundle installs aLogListener
on every discovered LogService
.
The listener forwards each received LogEntry
to the configured JUL Handler
s.
The mapping of JUL LogEntry
properties to OSGi
LogRecord
properties should be obvious with two
exceptions:
LogLevel.AUDIT
: is mapped to a JULLevel
with integer valueMAX_VALUE
.- Bundle: as this information has no direct representation
in the JUL
LogRecord
, it can be inserted into the log message (see below).
format
property is set for a handler, the log message
is post-processed with a MessageFormat
instance
created from the specified format
. The formatter is invoked
with the parameters "original message", "bundle symbolic name",
"bundle name", "bundle version", "thread info".
In order to e.g. add the bundle name to the message, the
format pattern "{0} [{2}]
" could be used.
Bundle properties
The following bundle properties configure the described behavior.Property | Description | Default |
---|---|---|
de.mnl.osgi.osgi2jul.handlers |
A comma separated list of Handler
classes. If the handlers are to be taken from a bundle,
use "<bundle symbolic name>:<class name> ".
For further configuration, an id can be appended as
"[<id>] ". |
|
de.mnl.osgi.osgi2jul.handler.<id>.format |
The format used to post-process messages before passing them to the handler (see above). | No post-processing |
de.mnl.osgi.osgi2jul.handler.<id>.level |
Used to set the level property of the handler. | None |
-
Class Summary Class Description ForwardingManager This class provides the activator for this service.HandlerConfig Holds the configuration for a handler.LogWriter This class implements a LogListener that forwards the LogEntries to a handler.