Well, you're going to want to do this programmatically, probably in the
selector.getLoggerRepository() method (or in a static initializer() if you
pre-configure everything) to be able to get a handle to the proper logger
repository to run configuration upon.
In any case, you can still use the same properties file. Simply define the
path to the log file as a property to be resolved when the
PropertyConfigurator configures things...
log4j.appender.A1.File=${log.path}/${log.name}.log
Now, normally you'd need to set system properties to get these resolved. But
that leaves you with a single value to use. Instead, what you can do is load
up the property file as a Properties object. Then, prior to each call to
configure(), add the "log.path" and "log.name" properties manually. Then pass
the properties object along with the repository to doConfigure(props,
repository). Change the values for said properties each time before you run
configure on the other repositories and you are golden.
Jake
On Fri, 11 Apr 2008 16:05:48 -0400
"Robert Pepersack" <[EMAIL PROTECTED]> wrote:
I have a RepositorySelector that manages several logging hierarchies and I
want to send the output of each Hierarchy to its own log file. I would like
to use the same configuration file for all of the Hierarchies, but have a
different log file for each Hierarchy. I'm using PropertyConfigurator and
FileAppender. Here are the contents of my log4j.properties file:
# Set root logger to DEBUG and add an appender named A1
log4j.rootLogger=DEBUG, A1
# Set appender A1 to be FileAppender
log4j.appender.A1=org.apache.log4j.FileAppender
log4j.appender.A1.File=C:\\JavaJobScheduler\\logs\\job_scheduler.log
log4j.appender.A1.Append=false
# Set appender A1 to use PatternLayout
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d %r [%t] %-5p %c.%M(): %m%n
Can this be done through configuration, or do I have to do it
programmatically? Is there an example?
Thanks,
Bob
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]