You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Chris Gerrard <cg...@sct.com> on 2001/12/18 00:40:27 UTC

log4j:WARN messages upon startup

I continue to get these messages when log4j starts up:
--
Logging: C:\{...}logging.config found, being used.
log4j:WARN File option not set for appender [STDOUT].
log4j:WARN Are you using FileAppender instead of ConsoleAppender?
Logging: C:\{...}logging.config found, was used.

The messages appear to be generated in  FileAppender's activateOptions
() method. (It's the only reference I can find.)

I am using a servlet to initialize log4j using a properties file named
"logging.config", and the code that generates these messages is:
--
System.out.println("Logging: " + configFile + " found, being used.");
PropertyConfigurator.configure(configFile);
System.out.println("Logging: " + configFile + " found, was used.");

If I edit the config file to include the line:
--
log4j.configDebug

I get the error messages:
--
Logging: C:\{...}logging.config found, being used.
log4j:WARN File option not set for appender [STDOUT].
log4j:WARN Are you using FileAppender instead of ConsoleAppender?
log4j:WARN [log4j.configDebug] is deprecated. Use [log4j.debug]
instead.

The last message is generated in log4j by the method:
PropertyConfigurator.doConfigure(Properties properties, Hierarchy
hierarchy)

The sequence of execution in log4j, from my servlet is:
PropertyConfigurator.configure(configFile);
 |-> configure(String ...)
         new PropertyConfigurator().doConfigure(configFilename,
Category.defaultHierarchy);
          |->   public
                void doConfigure(String configFileName, Hierarchy
hierarchy) {
                  Properties props = new Properties();
                  try {
                    FileInputStream istream = new
FileInputStream(configFileName);
                    props.load(istream);
                    istream.close();
                  }
                  catch (IOException e) {
                    LogLog.error("Could not read configuration file ["
+configFileName+"].", e);
                    LogLog.error("Ignoring configuration file [" +
configFileName+"].");
                    return;
                  }
                  // If we reach here, then the config file is
alright.
                  doConfigure(props, hierarchy); // <--- generates the
"deprecated" msg.
                }


Now, the interesting thing is that if my config file is misnamed, I
will receive the first LogLog.error() message from doConfigure() AFTER
the log4j.WARN messages.

So these messages appear to be coming from some reference to
FileAppender's .activateOptions() method that occurs BETWEEN
PropertyConfigurator.configure(configFile) and the attempt to actually
load the properties file.

My guess is that there's something happening in the instantiation of
the objects involved in the Category.defaultHierarchy parameter to the
PropertyConfigurator().doConfigure(String, Hierarchy) method. I can't
find it.

Can anyone help?

FWIW, all the logging works just as it should. I've used all sorts of
combinations of Categories and Priorities, used dynamic reloading of
the properties file, used ConfigureAndWatch. Everything works. I just
can't get rid of these nagging messages, and it's hurting my case to
use log4j in our production product.

One side note; the FileAppender's activateOptions()line:
      LogLog.warn("File option not set for appender ["+name+"].");
Uses the field "name" in the message. "name" is a field FileAppender
inherits from AppenderSkeleton via WriterSkeleton. I don't really know
if it's meaningful...

Thanks. Sorry about the length of the message.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: log4j:WARN messages upon startup

Posted by Don Taylor <do...@yahoo.com>.
Look at your properties file and answer the question log4j asked you:
*are* you using a FileAppender instead of a ConsoleAppender? If not
then post your properties file so we can see what's going on.

-- Don

--- Chris Gerrard <cg...@sct.com> wrote:
> 
> I continue to get these messages when log4j starts up:
> --
> Logging: C:\{...}logging.config found, being used.
> log4j:WARN File option not set for appender [STDOUT].
> log4j:WARN Are you using FileAppender instead of ConsoleAppender?
> Logging: C:\{...}logging.config found, was used.
> 
> The messages appear to be generated in  FileAppender's
> activateOptions
> () method. (It's the only reference I can find.)
> 
> I am using a servlet to initialize log4j using a properties file
> named
> "logging.config", and the code that generates these messages is:
> --
> System.out.println("Logging: " + configFile + " found, being used.");
> PropertyConfigurator.configure(configFile);
> System.out.println("Logging: " + configFile + " found, was used.");
> 
> If I edit the config file to include the line:
> --
> log4j.configDebug
> 
> I get the error messages:
> --
> Logging: C:\{...}logging.config found, being used.
> log4j:WARN File option not set for appender [STDOUT].
> log4j:WARN Are you using FileAppender instead of ConsoleAppender?
> log4j:WARN [log4j.configDebug] is deprecated. Use [log4j.debug]
> instead.
> 
> The last message is generated in log4j by the method:
> PropertyConfigurator.doConfigure(Properties properties, Hierarchy
> hierarchy)
> 
> The sequence of execution in log4j, from my servlet is:
> PropertyConfigurator.configure(configFile);
>  |-> configure(String ...)
>          new PropertyConfigurator().doConfigure(configFilename,
> Category.defaultHierarchy);
>           |->   public
>                 void doConfigure(String configFileName, Hierarchy
> hierarchy) {
>                   Properties props = new Properties();
>                   try {
>                     FileInputStream istream = new
> FileInputStream(configFileName);
>                     props.load(istream);
>                     istream.close();
>                   }
>                   catch (IOException e) {
>                     LogLog.error("Could not read configuration file
> ["
> +configFileName+"].", e);
>                     LogLog.error("Ignoring configuration file [" +
> configFileName+"].");
>                     return;
>                   }
>                   // If we reach here, then the config file is
> alright.
>                   doConfigure(props, hierarchy); // <--- generates
> the
> "deprecated" msg.
>                 }
> 
> 
> Now, the interesting thing is that if my config file is misnamed, I
> will receive the first LogLog.error() message from doConfigure()
> AFTER
> the log4j.WARN messages.
> 
> So these messages appear to be coming from some reference to
> FileAppender's .activateOptions() method that occurs BETWEEN
> PropertyConfigurator.configure(configFile) and the attempt to
> actually
> load the properties file.
> 
> My guess is that there's something happening in the instantiation of
> the objects involved in the Category.defaultHierarchy parameter to
> the
> PropertyConfigurator().doConfigure(String, Hierarchy) method. I can't
> find it.
> 
> Can anyone help?
> 
> FWIW, all the logging works just as it should. I've used all sorts of
> combinations of Categories and Priorities, used dynamic reloading of
> the properties file, used ConfigureAndWatch. Everything works. I just
> can't get rid of these nagging messages, and it's hurting my case to
> use log4j in our production product.
> 
> One side note; the FileAppender's activateOptions()line:
>       LogLog.warn("File option not set for appender ["+name+"].");
> Uses the field "name" in the message. "name" is a field FileAppender
> inherits from AppenderSkeleton via WriterSkeleton. I don't really
> know
> if it's meaningful...
> 
> Thanks. Sorry about the length of the message.
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>