You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Bertrand Delacretaz (JIRA)" <ji...@apache.org> on 2013/10/15 15:42:42 UTC

[jira] [Resolved] (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:all-tabpanel ]

Bertrand Delacretaz resolved SLING-3048.
----------------------------------------

    Resolution: Fixed

Patch applied in revisions 1521071 and 1532328, many thanks for your contribution!

> 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, SLING-3048-testcase.patch
>
>
> 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 was sent by Atlassian JIRA
(v6.1#6144)