I am devloping a Web Application with EJBs on WebSphere. Log4j is being used to log the user actions. I am using NDC to specify the user specific information on the logs generated. The problem is that sometimes NDC works and sometimes it does not. I dont have a clue why it does so. 'NDC.push()' is included in the LoginModule so that we have the
thread information containing the user login info. Similary 'NDC.pop()' is used when the user logs out.
A sample of log is included:
Pattern:
[DATE][<used by NDC>]\n[Calling Class][LEVEL]->[Message]\n\n
AS:
[%d{dd/MM/yyyy HH:mm:ss,SSS}][%53.53x]%n[%-15.15c][%-5.5p]->[%m]%n%n
Log:
[21/07/2006 12:28:49,000][ ]
[war.CoisServlet][INFO ]->[
Servlet Initializing...!!]
[21/07/2006 12:29:42,172][ Sess from 127.0.0.1 @ 2006-07-21 12:29:42.125]
[war.CoisServlet][INFO ]->[USER logins the app as akash akash]
[21/07/2006 12:29:42,172][ Sess from 127.0.0.1 @ 2006-07-21 12:29:42.125]
[war.CoisServlet][INFO ]->[Going for Login through Servlet]
[21/07/2006 12:29:42,375][ Sess from 127.0.0.1 @ 2006-07-21 12:29:42.125]
[nbean.LoginBean][INFO ]->[IN UserInfo doLogin asAKASHAKASHc6v5fr62fY5sZD5TkWzwbiF]
[21/07/2006 12:29:42,594][ Sess from 127.0.0.1 @ 2006-07-21 12:29:42.125]
[nbean.LoginBean][INFO ]->[checking ip s]
[21/07/2006 12:29:42,938][ Sess from 127.0.0.1 @ 2006-07-21 12:29:42.125]
[nbean.LoginBean][INFO ]->[ui ->
O.NDLS@priya.com AKASH DLI NDLS AKASH O NR 1234 CRIS01 1979 true]
[21/07/2006 12:29:43,391][ Sess from 127.0.0.1 @ 2006-07-21 12:29:42.125]
[war.CoisServlet][INFO ]->[Returning form Login Bean]
[21/07/2006 12:30:06,547][ ]
[war.CoisServlet][INFO ]->[USER -> Initiating Yard Stock Entry for Coach]
[21/07/2006 12:30:06,969][ ]
[war.CoisServlet][INFO ]->[System -> Collected data returning to YardStkImp.jsp]
[21/07/2006 12:30:24,031][ ]
[war.CoisServlet][INFO ]->[USER -> Initiating Submission]
[21/07/2006 12:30:24,062][ ]
[war.CoisServlet][INFO ]->[SYSTEM -> Going into Bean with data]
[21/07/2006 12:30:24,172][ ]
[.YardStkImpBean][INFO ]->[SYSTEM -> In Yard Stk Bean]
[21/07/2006 12:30:28,266][ ]
[war.CoisServlet][INFO ]->[SYSTEM -> Bean Op Completed. Going to YardStkImp.jsp]
[21/07/2006 12:30:28,469][ ]
[war.CoisServlet][INFO ]->[SYSTEM -> Operation Done]
[21/07/2006 12:32:43,062][ Sess from 127.0.0.1 @ 2006-07-21 12:29:42.125]
[war.CoisServlet][INFO ]->[.. going for logout...!!]
[21/07/2006 12:32:43,094][ Sess from 127.0.0.1 @ 2006-07-21 12:29:42.125]
[war.CoisServlet][INFO ]->[..SUCCESSFULL LOGOUT...!!.. thruu servlet]