shiro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jared Bunting (JIRA)" <>
Subject [jira] [Commented] (SHIRO-391) Enable Principal in Logs using SLF4J MDC
Date Mon, 21 Jan 2013 12:48:12 GMT


Jared Bunting commented on SHIRO-391:

Currently, there are two approaches that I am considering.

1. Set several values in the MDC context: "shiro.principal", "shiro.allPrincipals", "shiro.auth",
"shiro.isRunAs", "shiro.previousPrincipal", "shiro.allPreviousPrincipals".
2. Set two values in the MDC context: "shiro.subject", "shiro.simpleSubject" - the former
would be a formatted string that contains all of the information above and the latter would
only include primary principals.

I am currently leaning towards the first, as this would give users the greatest flexibility.
 It would also allow us to avoid the formatting and concatenation steps in the bind method.
 However, it involves binding a number of values.
> Enable Principal in Logs using SLF4J MDC
> ----------------------------------------
>                 Key: SHIRO-391
>                 URL:
>             Project: Shiro
>          Issue Type: Improvement
>            Reporter: Jan Stamer
>            Assignee: Jared Bunting
>            Priority: Minor
>             Fix For: 1.3.0
>         Attachments:
> 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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message