[
https://issues.apache.org/jira/browse/SHIRO-391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15655149#comment-15655149
]
Brian Demers commented on SHIRO-391:
------------------------------------
I just reverted this while prepping the 1.4 release.
I couldn't find the original thread, but from the context, I'm assuming the
discussion had to do with the fact that the principal may not be a simple
string (and there could be multiple principals involved with the request).
Some quick thoughts on the matter.
* A custom filter chain could be used to load the MDC context.
* Shiro could fire an event when a subject is bound/created, and Shiro could
provide a simple MDC listener, this might fill the 80/20 rule
> Enable Principal in Logs using SLF4J MDC
> ----------------------------------------
>
> Key: SHIRO-391
> URL: https://issues.apache.org/jira/browse/SHIRO-391
> Project: Shiro
> Issue Type: Improvement
> Reporter: Jan Stamer
> Assignee: Jared Bunting
> Priority: Minor
> Labels: patch
> Attachments: ThreadContext.java.patch
>
>
> Sometimes it is useful to log the user name. That way it can easily be traced
> which user faced an exception or where an error occurred.
> The Mapped Diagnostic Context (MDC) of SLF4J can be used for that as it uses
> the same mechanisms as Shiro already does. That way one can use
> %X{shiroSubject} in the log pattern. This will then be filled with the
> principal name or left blank.
> Remark: No additional libraries or anything are necessary for that. All
> that's needed is SLF4J and that's there already.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)