Philipp,

a) you don't need logback, but the Log Service spec doesn't define
appenders per say, so you either have to provide your own LogListener
implementation, fetch a LogStreamProvider and process the events, or maybe
the LogService implementation offers it's own appenders (my experience has
been that I want everything to land in the same place.)
b) you can use configuration admin to configure log levels as per the spec
[1] which is to say that you create a configuration using the following PID
scheme [2].

*Note:* every bundle has it's own LoggerContext (mapped to a configuration
PID as described in [2]). There is also a ROOT context which is effectively
the fallback for everything (so you could use that as the singular
configuration if you like.)

Logback support is really to unify all the different logging APIs into a
single backend because the stark reality is that you will encounter other
logging APIs if you spend enough time with your application and the effort
of handling each of those on it's own always causes pain. The goal of Felix
Logback is to make that scenario less painful.

Sincerely,
- Ray

[1] https://osgi.org/specification/osgi.cmpn/7.0.0/service.log.html#d0e2548
[2]
https://osgi.org/specification/osgi.cmpn/7.0.0/service.log.html#org.osgi.service.log.admin.LoggerContext.LOGGER_CONTEXT_PID

On Mon, Sep 17, 2018 at 5:25 AM Philipp Höfler <philipp.hoef...@pernexas.com>
wrote:

> Hi,
>
> with the latest update of the Felix SCR, I am able to get an instance of
> the LogService by referencing the LoggerFactory using this line of code:
> @Reference(service = LoggerFactory.class)
> private Logger _logger;
>
> Now, I would have expected, that I can configure the LogService through
> the Web Console (Configuration Admin).
> There is a menu LogService in the WebConsole and it says “Log Service is
> running”, but there is not one single log entry available nor can I change
> the log level of classes (or bundles).
>
> I found the documentation (
> http://felix.apache.org/documentation/subprojects/apache-felix-log.html)
> and it says that it is possible to configure the logging through the
> Configuration Admin.
> But it’s not clear to me, what exactly I have to do.
> Is it necessary to use LogBack (or any other logging framework)? According
> to my current understanding, I do not have to use an additional logging
> framework. Anyhow, do you recommend utilizing one?
>
> Obviously, I am missing something important.
> Could somebody please give me an introduction on how to properly use the
> LogService. I think I make correctly use of it in the code, but I do not
> understand how to use/configure it after compilation.
>
> Thanks,
> Philipp
>
>

-- 
*Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>
 (@rotty3000)
Senior Software Architect *Liferay, Inc.* <http://www.liferay.com>
 (@Liferay)
Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org> (@OSGiAlliance)

Reply via email to