logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: Different Loggers for Different Instances of Same Class
Date Sun, 06 Apr 2008 20:42:06 GMT

You can use per-instance loggers and name you loggers as...

private Logger logger;

JdbcFacade(String instanceNameQualifier) {
   this.logger = this.getClass().getName() + istanceNameQualifier;
}

instanceNameQualifier might be "A" or "B" or whether else you want it to be.


Jake

Robert Pepersack wrote:
> Hello.
> 
> Thanks in advance for your help.
> 
> I'm running scheduled jobs, and they create their own instances of my JDBC class.  For
example, JobA creates a new JdbcFacadeA, and JobB creates its own JdbcFacadeB.  I would like
to log each job in its own log (easy).  But, I want the output from JdbcFacadeA to go to the
log for JobA, and I want the output from JdbcFacadeB to go to JobB's log.  I'm using the log4j
convention for naming loggers, which uses the fully qualified class name.
> 
> How can I do this?
> 
> Thanks,
> 
> Robert Pepersack
> Senior Lead Developer
> Maryland Insurance Administration
> 410-468-2054
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message