I'm using XML files to configure Log4j. All is working fine.
I've got a couple of custom priorities, some filters using the
FileAppender. Life was good.
Then I discovered that I've got 1 log4j .xml file for EACH of
my different executables . . . and the only difference is the
filename.
Therefore, I tried using a single .xml config file and added
something that looks like this (once all the error handling is removed):
Category theRoot = Category.getRoot() ;
Appender theApp = theRoot.getAppender( "MyAppender" ) ;
FileAppender fileApp = (FileAppender) theApp ;
fileApp.setFile( thisExecutablesFileName ) ;
But it doesn't work. If I have a filename set in the xml file, it uses that.
If I don't, I get the following:
log4j:WARN File option not set for appender [MyAppender].
log4j:WARN Are you using FileAppender instead of ConsoleAppender?
log4j: Adding appender named [MyAppender] to category [root].
log4j:ERROR No output stream or file set for the appender named [MyAppender].
Any ideas how I can use the same .XML file for each of my executables
while still configuring each to write to a different output file ?
TIA.
----------------------------------------------------------------
Jay Riddell
Dorado Software
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]