You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Carsten Ziegeler <cz...@apache.org> on 2013/08/06 13:30:55 UTC

[RT] Logging and Logback

Hi,

i've the need for a custom log append not logging into a file. This is
something our current logging bundles do not support. By looking around
using logback could be an answer and I also found [1] where moving to
logback has already been discussed.

So I'm wondering what/how to this. One solution would be to do this on our
own as discussed in that thread, another solution would be to leverage
other logging solutions like maybe pax logging and just providing a
compatibility layer for our current configurations.

WDYT?

Regards
Carsten

[1]
http://apache-sling.73963.n3.nabble.com/Trying-to-convert-Sling-Logging-gt-Logback-How-much-backwards-compatibility-do-we-need-td4020965.html

-- 
Carsten Ziegeler
cziegeler@apache.org

Re: [RT] Logging and Logback

Posted by Felix Meschberger <fm...@adobe.com>.
Hi

I have now committed Chetans latest patch over the commons.log bundle. That is commons.log is now logback based and the old implementation has gone (will still be available in release 3.0.2 under vote and the SVN history).

Please check it out, and please crosscheck whether the license files look ok (we embedd the logback core and classic bundles as well as a client side JavaScript library for the web console).

Regards
Felix

Am 22.08.2013 um 03:13 schrieb Chetan Mehrotra:

> Hi,
> 
> I am done with most of the planned features with Sling Logabck extension
> [1]. To summarize it supports following features
> 
> * Compatible with existing Sling Commons Log
> * LogBack configuration can be provided via Logback config xml
> * ConfigurationAdmin integration - Logback Config can be enhanced via
> config obtained from OSGi configuration admin
> * Supports Appenders via Whiteboard pattern
> * Support providing Logback config as fragments through OSGi Service
> Registry
> * Feature rich WebConsole Plugin and Configuration Printer support
> 
> I have provided the implementation zip as part of SLING-2024. Current test
> coverage stands at ~50%.
> 
> Some queries going forward
> 
> 1. What should be the artifactId of the new implementation
> Currently I have set the artifactid (and package names) as
> org.apache.sling.extensions.logback. Should it be set to
> org.apache.sling.commons.log with major version number upgrade. As that
> would allow easier upgrades?
> 
> Kindly have a look at the patch provided and provide your feedback.
> 
> regards
> Chetan
> 
> [1] https://github.com/chetanmeh/sling-logback
> [2] https://issues.apache.org/jira/browse/SLING-2024
> [3] http://logback.qos.ch/manual/configuration.html#fileInclusion
> Chetan Mehrotra
> 
> On Tue, Aug 13, 2013 at 6:03 PM, Bertrand Delacretaz <bd...@apache.org>
> wrote:
>> On Tue, Aug 13, 2013 at 1:48 PM, Chetan Mehrotra
>> <ch...@gmail.com> wrote:
>>> ...I just swapped the log
>>> implementation in existing system and saw if the log were generated as
>>> expected or not. Adding automated testcase for such scenarios would
>>> take some decent effort...
>> 
>> granted...but I think we need this as subtle differences in the log
>> configuration mechanisms can lead to hard to troubleshoot issues in
>> the field.
>> 
>>> 
>>> So before I invest time in that wanted to see if there is interest in
>>> the Logback based implementation...
>> 
>> I haven't looked at your patch so far but in general I think it's a
>> great idea, especially as it brings MDC and Markers with it.
>> 
>> -Bertrand


Re: [RT] Logging and Logback

Posted by Chetan Mehrotra <ch...@gmail.com>.
Hi,

I am done with most of the planned features with Sling Logabck extension
[1]. To summarize it supports following features

* Compatible with existing Sling Commons Log
* LogBack configuration can be provided via Logback config xml
* ConfigurationAdmin integration - Logback Config can be enhanced via
config obtained from OSGi configuration admin
* Supports Appenders via Whiteboard pattern
* Support providing Logback config as fragments through OSGi Service
Registry
* Feature rich WebConsole Plugin and Configuration Printer support

I have provided the implementation zip as part of SLING-2024. Current test
coverage stands at ~50%.

Some queries going forward

1. What should be the artifactId of the new implementation
Currently I have set the artifactid (and package names) as
org.apache.sling.extensions.logback. Should it be set to
org.apache.sling.commons.log with major version number upgrade. As that
would allow easier upgrades?

Kindly have a look at the patch provided and provide your feedback.

regards
Chetan

[1] https://github.com/chetanmeh/sling-logback
[2] https://issues.apache.org/jira/browse/SLING-2024
[3] http://logback.qos.ch/manual/configuration.html#fileInclusion
Chetan Mehrotra

On Tue, Aug 13, 2013 at 6:03 PM, Bertrand Delacretaz <bd...@apache.org>
wrote:
> On Tue, Aug 13, 2013 at 1:48 PM, Chetan Mehrotra
> <ch...@gmail.com> wrote:
>> ...I just swapped the log
>> implementation in existing system and saw if the log were generated as
>> expected or not. Adding automated testcase for such scenarios would
>> take some decent effort...
>
> granted...but I think we need this as subtle differences in the log
> configuration mechanisms can lead to hard to troubleshoot issues in
> the field.
>
>>
>> So before I invest time in that wanted to see if there is interest in
>> the Logback based implementation...
>
> I haven't looked at your patch so far but in general I think it's a
> great idea, especially as it brings MDC and Markers with it.
>
> -Bertrand

Re: [RT] Logging and Logback

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Tue, Aug 13, 2013 at 1:48 PM, Chetan Mehrotra
<ch...@gmail.com> wrote:
> ...I just swapped the log
> implementation in existing system and saw if the log were generated as
> expected or not. Adding automated testcase for such scenarios would
> take some decent effort...

granted...but I think we need this as subtle differences in the log
configuration mechanisms can lead to hard to troubleshoot issues in
the field.

>
> So before I invest time in that wanted to see if there is interest in
> the Logback based implementation...

I haven't looked at your patch so far but in general I think it's a
great idea, especially as it brings MDC and Markers with it.

-Bertrand

Re: [RT] Logging and Logback

Posted by Chetan Mehrotra <ch...@gmail.com>.
Hi Bertrand,

> Is that covered by automated tests?

So far no automated testcase exist. I just swapped the log
implementation in existing system and saw if the log were generated as
expected or not. Adding automated testcase for such scenarios would
take some decent effort.

So before I invest time in that wanted to see if there is interest in
the Logback based implementation. Also want to have some discussion on
the approach to be taken for exposing various extension points in
Logback via OSGi

As of now the basic feature set is met and it meets my requirement for
local setup.

Chetan Mehrotra

Re: [RT] Logging and Logback

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi Chetan,

On Tue, Aug 13, 2013 at 1:11 PM, Chetan Mehrotra
<ch...@gmail.com> wrote:
> ...For maintaining configuration compatibility it uses LogConfig and
> LogWriter support from Felix's prototype...

Is that covered by automated tests?

IMO if we want to switch logging implementations (which I'm +1 on) we
need tests that validate the existing config mechanisms and work with
the new ones as well.

-Bertrand

Re: [RT] Logging and Logback

Posted by Chetan Mehrotra <ch...@gmail.com>.
Hi,

I was also looking for using Logback with Sling to simplify debugging
issues in multi threaded env via Markers and MDC.

Current implementation is available at [1]. It currently works and
provides all the features as supported by current Sling Commons Log.
In addition it enables registration of appenders via whiteboard
pattern also. There are some pending todo's referred to in the readme
file

For maintaining configuration compatibility it uses LogConfig and
LogWriter support from Felix's prototype

Kindly have a look and provide your feedback!!

Chetan Mehrotra

[1] https://github.com/chetanmeh/sling-logback


On Wed, Aug 7, 2013 at 5:20 PM, Felix Meschberger <fm...@adobe.com> wrote:
> Hi Carsten
>
> I started hacking around to this avail -- but I am nowhere near completion ...
>
> I committed my current (incomplete) work to https://svn.apache.org/repos/asf/sling/whiteboard/fmeschbe/logback
>
> Regards
> Felix
>
> Am 06.08.2013 um 13:30 schrieb Carsten Ziegeler:
>
>> Hi,
>>
>> i've the need for a custom log append not logging into a file. This is
>> something our current logging bundles do not support. By looking around
>> using logback could be an answer and I also found [1] where moving to
>> logback has already been discussed.
>>
>> So I'm wondering what/how to this. One solution would be to do this on our
>> own as discussed in that thread, another solution would be to leverage
>> other logging solutions like maybe pax logging and just providing a
>> compatibility layer for our current configurations.
>>
>> WDYT?
>>
>> Regards
>> Carsten
>>
>> [1]
>> http://apache-sling.73963.n3.nabble.com/Trying-to-convert-Sling-Logging-gt-Logback-How-much-backwards-compatibility-do-we-need-td4020965.html
>>
>> --
>> Carsten Ziegeler
>> cziegeler@apache.org
>

Re: [RT] Logging and Logback

Posted by Felix Meschberger <fm...@adobe.com>.
Hi Carsten

I started hacking around to this avail -- but I am nowhere near completion ...

I committed my current (incomplete) work to https://svn.apache.org/repos/asf/sling/whiteboard/fmeschbe/logback

Regards
Felix

Am 06.08.2013 um 13:30 schrieb Carsten Ziegeler:

> Hi,
> 
> i've the need for a custom log append not logging into a file. This is
> something our current logging bundles do not support. By looking around
> using logback could be an answer and I also found [1] where moving to
> logback has already been discussed.
> 
> So I'm wondering what/how to this. One solution would be to do this on our
> own as discussed in that thread, another solution would be to leverage
> other logging solutions like maybe pax logging and just providing a
> compatibility layer for our current configurations.
> 
> WDYT?
> 
> Regards
> Carsten
> 
> [1]
> http://apache-sling.73963.n3.nabble.com/Trying-to-convert-Sling-Logging-gt-Logback-How-much-backwards-compatibility-do-we-need-td4020965.html
> 
> -- 
> Carsten Ziegeler
> cziegeler@apache.org