One more thing: my use cases compel me to use config admin because I have
to support configuration filters. These can expand certain tokens into
absolute paths, or map properties to environment variables or even encrypt
certain keys.
So it may be valuable to find a way to configure out of properties rather
than the logback xml...

On Thu, Jul 12, 2018 at 11:18 AM Todor Boev <rinsv...@gmail.com> wrote:

> Configuring loggers through ConfigAdmin creates a bootstrap problem:
> You won't get logs until ConfgAdmin is up. It however can also log. Even
> if this is not the case you have to find a way to handle logs in the window
> between framework startup and log configuration.
> One way is to do an initial direct read of your log configuration from
> disk and then relay on ConfigAdmin for updates.
> This however presupposes your log configuration comes from disk - e.g.
> property files.
> Another way is to buffer logs, which is risky, because either the buffer
> can overflow or your system can crash before logging is configured.
> A third way is to run from an embedded default configuration - which dumps
> everything on the console typically.
>
> I have made two log integrations similar to this one over the years - one
> with the "direct read on init" approach, the other with "embedded defaults"
> approach. Can't say which is better.
> As for configuring appenders: you can map select appender types to config
> admin properties. E.g. console and rolling file. In addition you can add
> support for a generic type which tries to handle the appender class as a
> pojo with setters. I believe this is the approach taken by the felix JAAS
> integration for example.
>
> To recap - config admin support is expensive. In the end logging may turn
> out to be the one thing that needs to be embedded into the runtime or run
> from the system classpath as in this case.
>
> On Wed, Jul 11, 2018 at 9:54 PM Raymond Auge <raymond.a...@liferay.com>
> wrote:
>
>> On Wed, Jul 11, 2018 at 12:53 PM, Cristiano <cvgav...@gmail.com> wrote:
>>
>> > Wow, that is really cool !!
>> >
>> > great work, Raymond !
>> >
>> > I'm wondering... would be possible to setup logging (appenders or log
>> > level) using configuration admin service ?
>> >
>>
>> Your wish is my command...  to link you to the latest Log Service 1.4
>> specification which adds configuration of log levels via configuration
>> admin [1] 😀👍.
>>
>> However "appenders" in terms of the Log Service specification are still
>> handled through LogListener services. This has not changed. So no, the
>> logback appenders are not integrated with configuration admin.
>>
>> The Felix Logback integration simply manages the root logger context [2]
>> through it's configuration file. It also creates a bridge via a
>> LogListener
>> to pipe records to logback's appenders, whatever is configured in logback.
>>
>> [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#d0e2447
>>
>> Sincerely,
>> - Ray
>>
>>
>> >
>> > regards,
>> >
>> > Cristiano
>> >
>> >
>> > On 06/07/2018 15:31, Raymond Auge wrote:
>> >
>> >>    <dependency>
>> >>      <groupId>org.apache.felix</groupId>
>> >>      <artifactId>org.apache.felix.logback</artifactId>
>> >>      <version>1.0.0</version>
>> >>    </dependency>
>> >>
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
>> > For additional commands, e-mail: users-h...@felix.apache.org
>> >
>> >
>>
>>
>> --
>> *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