File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes NDC not doing its bit properly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "NDC not doing its bit properly" Watch "NDC not doing its bit properly" New topic
Author

NDC not doing its bit properly

Akash Bhatt
Greenhorn

Joined: Jul 26, 2005
Posts: 25
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]


...ToucH SkieS
AKASH
SCJP 1.4 86%
SCWCD 1.4 82%
Kumar Mettu
Greenhorn

Joined: Mar 01, 2008
Posts: 6
Akash,

Thats not how NDC works. You need to use NDC (Push and POP) per request not for whole session.

Kumar.


<A href="http://javaswamy.blogspot.com">My Blog</A>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NDC not doing its bit properly