Hi,
 
I am trying to set up Log4J to output messages to different files, depending on the client. Maybe I should give a little background. I wrapped Log4J and am running it as a service on my app server. Multiple "client" (which are actually other services on the app server) will use it for logging purposes. We want messages from each of the services to go to different output files, but I am having problems setting this up. The issue goes away if I run multiple instances of the Log service in different JVMs, but that is not possible. 
 
I am able to get the outcome I want with the code below, but I don't want to call PropertyConfigurator.configure every call, for performance reasons....I am sure you can see why.
 
Any suggestions? Does anyone have a sample configuration that does this?
 
Thanks,
 
 
    ...
        String instanceName = "foo";
    ...
        Category cat = Category.getInstance(instanceName);
    ...
        // get the appropriate configFile for the instance with name = instanceName
        String configFile = ....
 
        this.debug(configFile, "message");
    ...

    public void debug(String configFile, String message)
        throws LoggingUtilException
    {
        PropertyConfigurator.configure(configFile);
        cat.debug(message); 
    }

 
 

~Brian Kirkland
Advanced Technologies Group
Hewlett-Packard
(650) 314-4069
ecardFile: Brian Kirkland
 
A Life? Cool! Where can I download one of those from?

 

 

Reply via email to