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 Reg Sherwood <rs...@imagictv.com> on 2002/02/21 22:05:34 UTC

Log4j cannot find appenders

Hi,

I am using log4j 1.2 beta 3, and I receive the following message:

log4j:WARN No appenders could be found for logger (com.examples.testapp3.ui.BatchTestClient).
log4j:WARN Please initialize the log4j system properly.

My messages are still logged, but the message keeps appearing at the start after I have configured the logger via a PropertyConfigurator.configure( String ) call.

Here is the config file I am using to configure the log4j package.

  log4j.debug=true
  log4j.rootLogger=,A1,A2
  log4j.appender.A1=org.apache.log4j.ConsoleAppender
  log4j.appender.A1.layout=org.apache.log4j.PatternLayout
  log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
  log4j.appender.A2=org.apache.log4j.net.SocketAppender
  log4j.appender.A2.Port=10000
  log4j.appender.A2.RemoteHost=172.25.9.226

I have enabled log4j debugging, with the following results:

log4j: Parsing for [root] with value=[,A1,A2].
log4j: Parsing appender named "A1".
log4j: Parsing layout options for "A1".
log4j: Setting property [conversionPattern] to [%-4r [%t] %-5p %c %x - %m%n].
log4j:WARN No appenders could be found for logger (com.examples.testapp3.ui.BatchTestClient).
log4j:WARN Please initialize the log4j system properly.
log4j: End of parsing for "A1".
log4j: Parsed "A1" options.
log4j: Parsing appender named "A2".
log4j: Setting property [port] to [10000].
log4j: Setting property [remoteHost] to [172.25.9.226].
log4j: Parsed "A2" options.
log4j: Finished configuring.
430  [main] INFO  com.examples.testapp3.ui.BatchTestClient  - Inside of BatchTestClient
2123 [main] INFO  com.examples.testapp3.ui.BatchTestClient  - narrow the object to the consumer
2143 [main] DEBUG com.examples.testapp3.ui.BatchTestClient  - invode create
2223 [main] DEBUG com.examples.testapp3.ui.BatchTestClient  - Reg was here


Re: Log4j cannot find appenders

Posted by Reg Sherwood <rs...@imagictv.com>.
Hi,

I don't think so.  What I have done is,  placed a simple facade around the
log4j package.  Then in my test client I simply reference the facade to do
the logging.. as shown below.  Everything, including the logging is
executing within the same thread.

public class BatchTestClient
{
    private static ILog logger = Log.getLog(
BatchTestClient.class.getName() );
    public static void main(String[] argv)
    {
        try {
            Properties prop = new Properties();
            prop.setProperty( "log4jconfiguration", "P:\\etc\\app3.cfg" );
            logger.configure( prop1 );
            logger.info( "Test" );
            <blah>

-Reg



----- Original Message -----
From: "Ceki Gülcü" <ce...@qos.ch>
To: "Log4J Users List" <lo...@jakarta.apache.org>
Sent: Thursday, February 21, 2002 5:50 PM
Subject: Re: Log4j cannot find appenders


>
> Reg,
>
> Very strange. Are you by any chance doing the configuration on a separate
> thread? Regards, Ceki
>
> At 17:05 21.02.2002 -0400, Reg Sherwood wrote:
> >Hi,
> >
> >I am using log4j 1.2 beta 3, and I receive the following message:
> >
> >log4j:WARN No appenders could be found for logger
> >(com.examples.testapp3.ui.BatchTestClient).
> >log4j:WARN Please initialize the log4j system properly.
> >
> >My messages are still logged, but the message keeps appearing at the
start
> >after I have configured the logger via a PropertyConfigurator.configure(
> >String ) call.
> >
> >Here is the config file I am using to configure the log4j package.
> >
> >   log4j.debug=true
> >   log4j.rootLogger=,A1,A2
> >   log4j.appender.A1=org.apache.log4j.ConsoleAppender
> >   log4j.appender.A1.layout=org.apache.log4j.PatternLayout
> >   log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
> >   log4j.appender.A2=org.apache.log4j.net.SocketAppender
> >   log4j.appender.A2.Port=10000
> >   log4j.appender.A2.RemoteHost=172.25.9.226
> >
> >I have enabled log4j debugging, with the following results:
> >
> >log4j: Parsing for [root] with value=[,A1,A2].
> >log4j: Parsing appender named "A1".
> >log4j: Parsing layout options for "A1".
> >log4j: Setting property [conversionPattern] to [%-4r [%t] %-5p %c %x -
%m%n].
> >log4j:WARN No appenders could be found for logger
> >(com.examples.testapp3.ui.BatchTestClient).
> >log4j:WARN Please initialize the log4j system properly.
> >log4j: End of parsing for "A1".
> >log4j: Parsed "A1" options.
> >log4j: Parsing appender named "A2".
> >log4j: Setting property [port] to [10000].
> >log4j: Setting property [remoteHost] to [172.25.9.226].
> >log4j: Parsed "A2" options.
> >log4j: Finished configuring.
> >430  [main] INFO  com.examples.testapp3.ui.BatchTestClient  - Inside of
> >BatchTestClient
> >2123 [main] INFO  com.examples.testapp3.ui.BatchTestClient  - narrow the
> >object to the consumer
> >2143 [main] DEBUG com.examples.testapp3.ui.BatchTestClient  - invode
create
> >2223 [main] DEBUG com.examples.testapp3.ui.BatchTestClient  - Reg was
here
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


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


Re: Log4j cannot find appenders

Posted by Ceki Gülcü <ce...@qos.ch>.
Reg,

Very strange. Are you by any chance doing the configuration on a separate 
thread? Regards, Ceki

At 17:05 21.02.2002 -0400, Reg Sherwood wrote:
>Hi,
>
>I am using log4j 1.2 beta 3, and I receive the following message:
>
>log4j:WARN No appenders could be found for logger 
>(com.examples.testapp3.ui.BatchTestClient).
>log4j:WARN Please initialize the log4j system properly.
>
>My messages are still logged, but the message keeps appearing at the start 
>after I have configured the logger via a PropertyConfigurator.configure( 
>String ) call.
>
>Here is the config file I am using to configure the log4j package.
>
>   log4j.debug=true
>   log4j.rootLogger=,A1,A2
>   log4j.appender.A1=org.apache.log4j.ConsoleAppender
>   log4j.appender.A1.layout=org.apache.log4j.PatternLayout
>   log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
>   log4j.appender.A2=org.apache.log4j.net.SocketAppender
>   log4j.appender.A2.Port=10000
>   log4j.appender.A2.RemoteHost=172.25.9.226
>
>I have enabled log4j debugging, with the following results:
>
>log4j: Parsing for [root] with value=[,A1,A2].
>log4j: Parsing appender named "A1".
>log4j: Parsing layout options for "A1".
>log4j: Setting property [conversionPattern] to [%-4r [%t] %-5p %c %x - %m%n].
>log4j:WARN No appenders could be found for logger 
>(com.examples.testapp3.ui.BatchTestClient).
>log4j:WARN Please initialize the log4j system properly.
>log4j: End of parsing for "A1".
>log4j: Parsed "A1" options.
>log4j: Parsing appender named "A2".
>log4j: Setting property [port] to [10000].
>log4j: Setting property [remoteHost] to [172.25.9.226].
>log4j: Parsed "A2" options.
>log4j: Finished configuring.
>430  [main] INFO  com.examples.testapp3.ui.BatchTestClient  - Inside of 
>BatchTestClient
>2123 [main] INFO  com.examples.testapp3.ui.BatchTestClient  - narrow the 
>object to the consumer
>2143 [main] DEBUG com.examples.testapp3.ui.BatchTestClient  - invode create
>2223 [main] DEBUG com.examples.testapp3.ui.BatchTestClient  - Reg was here


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