This content has been marked as final.
Show 3 replies
-
1. Re: How can I log principal for every log4j statement
starksm64 Apr 15, 2004 12:42 PM (in response to philc)Yes, you would have to use the MDC to push the caller identity:
Principal p = ...; MDC.put("principal", p);
and use this value in the layout:<layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d %X{principal} %-5p [%c] %m%n"/> </layout>
-
2. Re: How can I log principal for every log4j statement
philc Apr 17, 2004 1:13 PM (in response to philc)Thanks, That's amazing. It's so Simple!
I think the code to put the principal in the MDC should be in an interceptor placed right after the SecurityInterceptor. Should this not be part of the default JBoss container-configuration since it is so useful? I will write the Interceptor and post it here later.
Philippe -
3. Re: How can I log principal for every log4j statement
starksm64 Apr 17, 2004 8:18 PM (in response to philc)No, this is not a general configuration that should be imposed on everyone.