You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Carl Hall <ca...@gmail.com> on 2009/04/16 20:32:40 UTC

Proper logging

What's the proper way to use logging within Sling?  Should I go with
the LogService or one of the log bundles exported bits (slf4j, jcl,
LogBack)?

Re: Proper logging

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Carl,

Carl Hall schrieb:
> On Thu, Apr 16, 2009 at 15:17, Felix Meschberger <fm...@gmail.com> wrote:
>> If you have simple OSGi bundles, you might also want to use the LogService.
> 
> If I don't use LogService, will I still be able to set the log level
> through the admin console?

Yes. As I said, ultimately everything (LOG4J calls, LogService calls,
JCL calls and SLF4J calls) goes through our SLF4J backend, which is
configured through the console.

There is one catch with LogService: The is also the LogReader service,
which provides access to all log entries (basically unfiltered, but
possibly limited by number) written through the LogService only. The
LogReader does not provide access to log entries written through any of
the other logging APIs provide.

Regards
Felix

Re: Proper logging

Posted by Carl Hall <ca...@gmail.com>.
On Thu, Apr 16, 2009 at 15:17, Felix Meschberger <fm...@gmail.com> wrote:
> If you have simple OSGi bundles, you might also want to use the LogService.

If I don't use LogService, will I still be able to set the log level
through the admin console?

Re: Proper logging

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Carl,

Carl Hall schrieb:
> What's the proper way to use logging within Sling?  Should I go with
> the LogService or one of the log bundles exported bits (slf4j, jcl,
> LogBack)?

The short answer: it depends ;-)

Generally, I would go for SLF4J, which is the main logging API used and
provided. Both JCL and LOG4J are used by adapting to SLF4J.

If you have simple OSGi bundles, you might also want to use the LogService.

In the end all logging API go back to our own internal SLF4J SPI
implementation.

Regards
Felix