I think the correct syntax would be %X{userId}
See the PatternLayout javadoc page for exact details on %X. -Mark > -----Original Message----- > From: Benoit Voisin [mailto:[EMAIL PROTECTED]] > Sent: Monday, May 20, 2002 11:54 PM > To: 'Log4J Users List' > Subject: RE: Defining layout and using objects to log information. > > > I think the easiest way is to use the MDC : > > Any place in your code when you know the userId, call : > MDC.put("userId",userId); > > You can then access it in the Appender : > > event.getMDC("userId"); > > If you use a PatternLayout, include > "x{userId}" in the pattern (I'm am not 100% sure about this > last syntax) > > Ben > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]] > Sent: 20 May 2002 18:19 > To: [EMAIL PROTECTED] > Subject: Defining layout and using objects to log information. > > > > > > > Hi > > I have just started using log4j. > I need some information / guidance on how to log information into a > database. > I want to log my own information like user id, transaction id > etc. which I > am > storing in an object. > Is there any way I can pass objects to the Appender which can log the > information held in that object. > > Aashish > > -------------------------------------------------------------- > -------------- > ----------------------------------------------- > > This email message (including any attachment) is confidential > and may be > legally > privileged. > It is intended solely for the addressee. If you are not the > addressee, you > may > not disclose it, copy it, distribute it or take or omit to > take any action > on > foot of it. Any such act or omission is prohibited and may be > unlawful. This > message (including any attachment) is transmitted for > discussion purposes > only. > It is protected by copyright laws and it has no other legal > or contractual > standing. > > > > > ********************************************************************** > This email and any files transmitted with it are confidential and > intended solely for the use of the individual or entity to whom they > are addressed. If you have received this email in error please notify > the system manager. > > This footnote also confirms that this email message has been swept by > MIMEsweeper for the presence of computer viruses. > > www.Kindlesystems.com > ********************************************************************** > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>