You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Chetan Mehrotra (JIRA)" <ji...@apache.org> on 2013/11/13 09:48:32 UTC

[jira] [Resolved] (SLING-3242) Allow refering to OSGi appenders from within Logback config

     [ https://issues.apache.org/jira/browse/SLING-3242?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chetan Mehrotra resolved SLING-3242.
------------------------------------

    Resolution: Fixed

Added support in rev r1541422

It can be used in following manner

{code:xml}
<configuration>
  <newRule pattern="*/configuration/osgi"
           actionClass="org.apache.sling.commons.log.logback.OsgiAction"/>
  <newRule pattern="*/configuration/appender-ref-osgi"
           actionClass="org.apache.sling.commons.log.logback.OsgiAppenderRefAction"/>
  <osgi/>

  <logger name="foo.ref.osgi" level="DEBUG">
    <appender-ref-osgi ref="TestAppender" />
  </logger>

    ...
</configuration>
{code}

In brief 
* Define a new action and map it to {{appender-ref-osgi ref}}
* Refer to the name of the OSGi based Appender using {{appender-ref-osgi ref}}

The implementation takes care of the OSGi service dynamics also i.e. when config is read then service might not be registered. So it would take care that when the service is registered then it is attached to appropriate loggers

> Allow refering to OSGi appenders from within Logback config
> -----------------------------------------------------------
>
>                 Key: SLING-3242
>                 URL: https://issues.apache.org/jira/browse/SLING-3242
>             Project: Sling
>          Issue Type: Improvement
>          Components: Commons
>    Affects Versions: Commons Log 3.0.0
>            Reporter: Chetan Mehrotra
>            Assignee: Chetan Mehrotra
>             Fix For: Commons Log 4.0.0
>
>
> Default Logback config only allows referring to appenders defined within the config file. To enable better integration with OSGi it would be better if one can refer to an appender which is implemented as an OSGi service from within the config.
> In such case logging system must attach the appender to the logger whenever the appender service is registered



--
This message was sent by Atlassian JIRA
(v6.1#6144)