In a distributed environment, how can I configure log4j to log to different files for each JVM instance in the same host?

StackOverflow https://stackoverflow.com/questions/3024722

Question

My application runs on IBM WebSphere 6.1 Network Deployment. The application have several JSP files and Java classes. Today each host have only one JVM instance but my intention is to start another instance on each host. How can I configure log4j to log to different files for each JVM instance in the same host? I thought of using variable substitution on log4j XML configuration file but it only works with system properties. So, it is safe and recommended to set a custom system property just to store the JVM name? Anyone knows another strategy to achieve this in a 'elegant' way?

Was it helpful?

Solution

I've find out a system property that already exists (IBM WAS ND 6.1) and provides the JVM name (am.appserver). But I'm open to alternative suggestions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top