At 05:14 PM 11/1/2004 -0600, you wrote:
>I used Jacob Kjome's InitContextListener and ContextClassLoaderSelector
>classes to separate the logging for 2 test web apps that I'm writing.

First, you should be using the ContextJNDISelector rather than the ContextClassLoaderSelector. The latter is problematic as behavior can change as classloader behavior changes.

Second, which version of log4j-sandbox are you using? By that I mean, did you check out the tagged (unofficial) release of LOG4J_SANDBOX_ALPHA2 or LOG4J_SANDBOX_ALPHA3? If the latter, this may very well not work well with the ContextClassLoaderSelector because of some classloading stuff I did to avoid class cast exceptions in certain cases (case in point of behavior changing as classloading changes). If you checked out the HEAD, you've probably noticed that ContextJNDISelector is in the Attic (if you found it at all). This is because Ceki moved it to log4j proper (and made many changes specific to log4j-1.3). I suggest you check out LOG4J_SANDBOX_ALPHA3 which will include ContextJNDISelector (compatible with Log4j-1.2.x) and use it instead of ContextClassLoaderSelector.

>
>I put the log4j-1.2.8.jar in C:\Program Files\Apache Software
>Foundation\Tomcat 5.0\shared\lib and coded something like the following:
>
>webapp1
>-------
>MDC.put("AppName", "foo");
>logger.info("app1 here");
>
>webapp2
>-------
>MDC.put("AppName", "bar");
>logger.info("app2 here");
>
>The FileAppenders I'm using are writing to the correct log files but the
>values in the MDC for app1 appear to overwritten by values from app2.
>In the debugger it appears that the same MDC object and its members are
>referenced by both webapps, thus explaining the overwriting part.
>
>Can I put the log4j-1.2.8.jar in the shared/lib or common/lib and still
>use the MDC in this fashion?
>

I'm not positive how this might affect things, but please do as I suggest above and use ContextJNDISelector. If that doesn't work any better, then post a follow-up here and we'll have a look at other solutions.

Jake


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to