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 2014/06/09 10:57:03 UTC
[jira] [Closed] (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 ]
Chetan Mehrotra closed SLING-3048.
----------------------------------
> 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
> Assignee: Chetan Mehrotra
> Fix For: SLF4J MDC Filter 1.0.0
>
> Attachments: SLING-3048-testcase.patch, 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 was sent by Atlassian JIRA
(v6.2#6252)