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/09/09 15:25:52 UTC

[jira] [Comment Edited] (SLING-3048) Filter to populate SLF4J MDC with request details

    [ https://issues.apache.org/jira/browse/SLING-3048?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13761807#comment-13761807 ] 

Chetan Mehrotra edited comment on SLING-3048 at 9/9/13 1:23 PM:
----------------------------------------------------------------

Thanks Bertrand!! 

Would sure add some testcase as soon as I get some time. As the logic is pretty small I tried it on a running Sling instance and it works as expected. Bug should not be closed untill then :)
                
      was (Author: chetanm):
    Thanks Bertrand!! 

Would sure add some testcase as soon as I get some time to validate the implementation (which anyway is quite small). Bug should not be closed untill then :)
                  
> Filter to populate SLF4J MDC with request details
> -------------------------------------------------
>
>                 Key: SLING-3048
>                 URL: https://issues.apache.org/jira/browse/SLING-3048
>             Project: Sling
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Chetan Mehrotra
>         Attachments: org.apache.sling.extensions.mdc-0.0.1-SNAPSHOT-src.zip
>
>
> With Commons Log moving to Logback its possible to use MDC [1] support of SLF4J in Sling to get better logs and also enable better filtering of logs. The patch adds a new extension module which registers a {{MDCInsertingFilter}}. This filter can extract information from incoming request and add them to the MDC
> Features supported
> 1. By default expose details like Request path, Query String etc based on [3]
> 2. Exposes OSGi config where one can define what HTTP Header, Parameter or Cookie needs to be added to MDC
> 3. Exposes Session ID, USer Information from RequestResolver associated with current thread of execution
> This information can then later be exposed via logs like shown below. Here we expose the SessionID as part of log
> ---
> %d{dd.MM.yyyy HH:mm:ss.SSS} *%level* [%thread] %logger [%X{jcr.sessionId}] %msg%n
> ---
> The same information can also be used to filter logs based on user,url etc or used in custom Logging event evaluator
> For more details refer to [2]
> [1] http://www.slf4j.org/manual.html#mdc
> [2] https://github.com/chetanmeh/sling-logback/tree/master/mdc
> [3] http://logback.qos.ch/manual/mdc.html#mis 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira