pkriens opened a new pull request #36:
URL: https://github.com/apache/felix-dev/pull/36
The OSGi specifications mandates component relative
logging on the component's bundle and using the
implementation class as logger name.
This can be quite inconvenient since SCR is rather
enthusiastic logger. If the component's bundle has
DEBUG logging enabled, the customer's logging messages
tend to get overshadowed.
Also, the component logger could be disabled, but
then the bundle logger was used, and if the bundle
logger was disabled, the SCR logger was used. This
is quite inconvenient.
The code was not properly handling the case when
a LoggerFactory would disappear or a bundle would
stop.
Last, the code looked like it had grown a lot over time.
This patch will provide an (almost) source compatible
version of the SCR logging class ScrLogger, ComponentLogger,
and BundleLogger, only their creation differs.
The default behavior is (or should be) as today. There
is one exception, we will not delegate to the parent
since this seems a bug. The logger hierarchy is much better
handled by the Logger Admin.
The extension has a new configuration property:
ds.log.extension ::= 'true' | 'false'
If set to true, the logging is not required to conform
to the OSGi specification.
ScrLogManager – Access point for SCR logging. It provides
a static method to create a ScrLogger. The ScrLogger gives
access to a BundleLogger, and this gives access to a
ComponentLogger.
The stdout logger has been removed and the fallback to
System.out/err is now handled in the ScrLogManager.
ExtLogManager – Implements the extension
LogManager – However, the internals are quite different. First
there is a LogManager that handles the interaction
between the OSGi service registry and the LoggerFactory,
cleaning up when the factory goes or the bundle goes.
This class has no _policy_. It uses a _facade_ to handle the
life cycle issues.
The InternalLogger had a Level that was used by all the code but the
API of the logger objects was defined by the AbstractLogger. Since
the InternalLogger had no meaning anymore, it is used as the
base interface for the logger _interfaces_. The scr, bundle, and
component logger objects are now almost empty interfaces.
Package looks busier than I like, and many classes are almost empty
but this way there is almost no change in the rest of the code base.
## Testing
An extensive JUnit test was added in LoggerTest that has almost full
code coverage.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]