logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jay Riddell" <jridd...@doradosoftware.com>
Subject Overriding an Xml Configuration's settings
Date Wed, 08 Aug 2001 02:13:44 GMT
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

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 ?


Jay Riddell
Dorado Software

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

View raw message