You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by David Sanders <ds...@chaincast.com> on 2001/01/29 19:03:19 UTC

Multiple apps in same JVM

In order to run more app instances, e.g., HTTP load test clients, on a host,
I often run multiple instances per machine.  For example, the app may
instantiate 50 instances of a class, each in its own thread.

I need to distinguish the 50 instances in the log4j output.

- How can each app instance (w/i same JVM) go to a different appender, e.g.,
file?  Does than a Category object for each of the 50 instances?

- Assume each of the 50 app instances spawns several threads, e.g., worker
threads.  In order for each app instance's threads to log to the appender
for that app instance, would the Category objects have to be passed (CTOR or
setter) to each associated thread?

- Instead of an appender per app instance, NDC could be used.  But, all
threads associated with an app instance's main thread would have to inherit
NDC stack from spawning thread?

Thank you.