logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Stauffer" <stauffer.ja...@gmail.com>
Subject Re: slf5s.ndc
Date Thu, 07 Dec 2006 18:24:22 GMT
You probably want to set the username and session id with MDC.put and
then you can include them with %X{key} where key is the first
parameter that you passed to MDC.put.

On 12/7/06, R. Markham <markham.r@gmx.de> wrote:
>
>
> Hi All.
>
>
>
> I am new in this forum. I have a web application. I am using Weblogic server
> 9.1 as a application server. In the log messages I want to put the user
> name, so I can trace the usage of the system related to the user name. I
> think I must use the category %x[slf5s.ndc]
>
>
>
> Here is my log4j.xml
>
>
>
>    <appender name="developer"
> class="org.apache.log4j.TimeSizeRollingFileAppender">
>
>       <param name="File" value="./config/btn/logs/btn_prd.txt"/>
>
>       <param name="DatePattern" value="'.'yyyy-MM-dd"/>
>
>       <param name="maxFileSize" value="30MB"/>
>
>       <param name="maxBackupIndex" value="40"/>
>
>       <layout class="org.apache.log4j.PatternLayout">
>
>          <param name="ConversionPattern"
> value="[slf5s.start]%d{ABSOLUTE}[slf5s.DATE] %p[slf5s.PRIORITY]
> %x[slf5s.NDC] %t[slf5s.THREAD] %c[slf5s.CATEGORY]%n%m[slf5s.MESSAGE]%n%n"/>
>
>       </layout>
>
>    </appender>
>
>
>
> I am not clear how I can log the information I want to eg username or
> session id in the log file.
>
> TIA
>
>
>
> Regards
>
>
>
>
>
> Richard Markham
>
>
>
>
>


-- 
James Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message