You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "R. Markham" <ma...@gmx.de> on 2006/12/07 16:52:59 UTC
slf5s.ndc
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
Re: slf5s.ndc
Posted by James Stauffer <st...@gmail.com>.
You would search for NDC.push. "%x" prints the NDC info.
On 12/8/06, R. Markham <ma...@gmx.de> wrote:
> I am migrating an web application from WLS(Weblogic Server) 6.1 to 9.1. In
> the previous application the lo4j.xml contains this snippet
>
> <appender name="developer"
> class="org.apache.log4j.DailyRollingFileAppender">
> <param name="File" value="./config/btn/logs/btn_tst.txt"/>
> <param name="DatePattern" value="'.'yyyy-MM-dd"/>
> <!-- <param name="maxFileSize" value="30MB"/>
> <param name="maxBackupIndex" value="10"/> -->
> <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>
>
> And the expression %x[slf5s.NDC] put the name of the user name in the log
> output automatically. In the original source which is from 2002 I don't find
> any line of code with MDC.put or NDC.put
>
> I am wondering why this feature doesn't work any more.
>
> Can you tell me the meaning of slf5s I can't anything what explain slf5s.
>
> Regards
>
> Richard Markham
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: James Stauffer [mailto:stauffer.james@gmail.com]
> Gesendet: Donnerstag, 7. Dezember 2006 19:24
> An: Log4J Users List
> Betreff: Re: slf5s.ndc
>
> 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 <ma...@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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
--
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
AW: slf5s.ndc
Posted by "R. Markham" <ma...@gmx.de>.
I am migrating an web application from WLS(Weblogic Server) 6.1 to 9.1. In
the previous application the lo4j.xml contains this snippet
<appender name="developer"
class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="./config/btn/logs/btn_tst.txt"/>
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<!-- <param name="maxFileSize" value="30MB"/>
<param name="maxBackupIndex" value="10"/> -->
<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>
And the expression %x[slf5s.NDC] put the name of the user name in the log
output automatically. In the original source which is from 2002 I don't find
any line of code with MDC.put or NDC.put
I am wondering why this feature doesn't work any more.
Can you tell me the meaning of slf5s I can't anything what explain slf5s.
Regards
Richard Markham
-----Ursprüngliche Nachricht-----
Von: James Stauffer [mailto:stauffer.james@gmail.com]
Gesendet: Donnerstag, 7. Dezember 2006 19:24
An: Log4J Users List
Betreff: Re: slf5s.ndc
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 <ma...@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
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: slf5s.ndc
Posted by James Stauffer <st...@gmail.com>.
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 <ma...@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