2 Replies Latest reply on Jun 26, 2009 10:04 AM by adalse0

    Problem with NDC

    adalse0

      Hi everybody,

      i'm not sure if this is the right section for my post,
      but i couldn't find something more suitable...

      I'm working on a tapestry application and we found out,
      that it would be very helpful using NDC to assign every log message to the user who triggered it.

      After tapestry provides the method pageBeginRender() and pageEndRender(), which are called before and after rendering of each page, it put the NDC.push() method in the pageBeginRender-method and NDC.pop() and remove() to pageEndRender().

      I made these changes and testet the result in my local development environment and saw that everything worked. (My local environment consists of a JBoss and a standalone Tomcat, because in our case this is more comfortable for GUI development)

      After checking in these changes and taking a look into the logfile of our nightly build server (which is using no standalone tomcat but just one JBoss) i saw that some log messages include the information added via NDC and others do not.

      After a more exact view on the logfile, i think that the problem is the following:

      When we are calling a ejb-method (which calls push(), pop() and remove() on her part) on a page, the ejb-method's pop() also affects my NDC in Webclient?!?

      If this is really the problem, i'm wondering why our serverside code runs in the same thread than the WebClient?!?

      I would be grateful about every hint you can give me onthis topic, thanks.