My guess is that the following lines are not correct.
> > # Set appenders for application classes
> > log4j.logger.MyLogger_application=INFO, APP_LOG, console
> >
> > # Set appenders for messages
> > log4j.logger.test.MyLoggerThread=ALL, MSG_LOG, console

I don't use the properties format so I don't know for sure.  If they
were you would get some messages sent to the console twice.  I.E.
Since the root logger sends messages to the console, those loggers
don't need to send it to the console also.  Include the category in
the console appender to verify what you should have in your config
file.

On 1/20/06, Pagnin Roberto <[EMAIL PROTECTED]> wrote:
> Hi James, set to INFO the root logger's level, and different result obtained, 
> no more "Log4j:WARN. No appenders could be..." error but nothing in the file 
> (messages have  correclty logged to console).
> Any idea?   Thanks
>
> Rob
>
> -----Messaggio originale-----
> Da: James Stauffer [mailto:[EMAIL PROTECTED]
> Inviato: giovedì 19 gennaio 2006 17.30
> A: Log4J Users List
> Oggetto: Re: R: Application with two loggers - The second one doesn't log 
> anything
>
> You only need the -D option to specify the configuration file if you
> use automatic configuration.  Since you use
> PropertyConfigurator.configureAndWatch, you don't need to use -D.
>
> In your properties file you probably need to specify a level for the
> root logger.
>
> On 1/19/06, Pagnin Roberto <[EMAIL PROTECTED]> wrote:
> > Hi James, I put the -D<option> because I've read on some forums that the 
> > error "Log4j:WARN. No appenders could be found for 
> > logger(MyLoggerThread.class) "  is a problem of pointing to the right log4j 
> > config file (so this was one of the many tries for solving the trouble).   
> > In the application I configure Log4j in this way:
> >
> > appPropPath = args[0];
> > log4jPropPath = args[1];
> > try
> > {
> >         log4jRefreshTime = Long.parseLong(args[2]);
> > }
> > catch (NumberFormatException ex)
> > {
> >         System.err.println("ERROR - Log4j Refresh Time param. MUST be a 
> > number.");
> >         ex.printStackTrace();
> >         System.exit(1);
> > }
> >
> > // Configure log4j for application logging
> > PropertyConfigurator.configureAndWatch(log4jPropPath,log4jRefreshTime);
> >
> >
> > Thanks
> > Rob
> >
> >
> > -----Messaggio originale-----
> > Da: James Stauffer [mailto:[EMAIL PROTECTED]
> > Inviato: mercoledì 18 gennaio 2006 18.08
> > A: Log4J Users List
> > Oggetto: Re: Application with two loggers - The second one doesn't log 
> > anything
> >
> > Why is log4j.properties in the command line twice?  Do you use
> > automatic configuration?
> >
> > On 1/18/06, Pagnin Roberto <[EMAIL PROTECTED]> wrote:
> > > The application is a JMS client that logs application messages in a file
> > > and JMS received messages in another file.
> > > As in subject, my application experiences a problem, the 2nd defined
> > > logger doesn't work, and in the working log I've found the message "
> > > Log4j:WARN. No appenders could be found for logger
> > > (MyLoggerThread.class) ".
> > > Is out there anybody that could help me ?  Thank you in advance
> > > Here follow some informations.
> > >
> > > Launch batch (start.sh)
> > > -----------------------
> > > #!/bin/sh
> > > /usr/j2se/jre/bin/java -cp
> > > /opt/test/:/opt/test/mylogger.jar:/opt/test/lib/log4j-1.2.11.jar:/opt/te
> > > st/lib/jms.jar:/opt/test/lib/sonic_Client.jar:/opt/test/lib/sonic_SF.jar
> > > -Dlog4j.configuration=file:./log4j.properties test.MyLogger
> > > mylogger.properties ./log4j.properties 1000
> > >
> > >
> > > log4j.properties and mylogger,jar are in /opt/test, libraries are in
> > > /opt/test/lib
> > >
> > >
> > > Log4j.properties
> > > ----------------
> > > # Log4j parameters
> > > log4j.rootLogger=console
> > > delayLog4jFileChange = 20
> > >
> > > # Set appenders for application classes
> > > log4j.logger.MyLogger_application=INFO, APP_LOG, console
> > >
> > > # Set appenders for messages
> > > log4j.logger.test.MyLoggerThread=ALL, MSG_LOG, console
> > >
> > >
> > > # Define parameters for log on the console
> > > log4j.appender.console=org.apache.log4j.ConsoleAppender
> > > log4j.appender.console.layout=org.apache.log4j.PatternLayout
> > > log4j.appender.console.layout.ConversionPattern=[%d][%p (%F:%L)] %m%n
> > >
> > > # Define parameters for the log on the file APP_LOG
> > > log4j.appender.APP_LOG=org.apache.log4j.RollingFileAppender
> > > log4j.appender.APP_LOG.File=./log/sciplogger.log
> > > log4j.appender.APP_LOG.MaxFileSize=5000Kb
> > > log4j.appender.APP_LOG.MaxBackupIndex=1
> > > log4j.appender.APP_LOG.layout=org.apache.log4j.PatternLayout
> > > log4j.appender.APP_LOG.layout.ConversionPattern=[%d] [%p (%F:%L)] %m%n
> > >
> > > # Define parameters for the log on the file MSG_LOG
> > > log4j.appender.MSG_LOG=org.apache.log4j.RollingFileAppender
> > > log4j.appender.MSG_LOG.file=./log/SCIP_messages.log
> > > log4j.appender.APP_LOG.MaxFileSize=5000Kb
> > > log4j.appender.APP_LOG.MaxBackupIndex=1
> > > log4j.appender.MSG_LOG.layout=org.apache.log4j.PatternLayout
> > > log4j.appender.MSG_LOG.layout.ConversionPattern=%m%n
> > >
> > >
> > > Application - Class MyLoggerThread.java (inside mylogger.jar)
> > > -------------------------------------------------------------
> > >
> > > ...
> > > // Logger for application operation info
> > > private static Logger applLogger =
> > > Logger.getLogger("MyLogger_application");
> > >
> > > // Logger for messages
> > > private static Logger messageLogger =
> > > Logger.getLogger(test.MyLoggerThread.class);
> > >
> > > ...
> > > ...
> > >
> > > public synchronized void onMessage(Message message) {
> > >
> > > ...
> > >
> > > messageLogger.info(msg.toString()); // Doesn't log anything!
> > >
> > > applLogger.debug("JMS message received: " + msg.toString());  // It
> > > works!
> > >
> > > ...
> > >
> > > }
> > >
> > > }
> > >
> > > Rob
> > >
> > >
> > >
> > >
> > > Gruppo Telecom Italia - Direzione e coordinamento di Telecom Italia S.p.A.
> > >
> > > ====================================================================
> > > CONFIDENTIALITY NOTICE
> > > This message and its attachments are addressed solely to the persons
> > > above and may contain confidential information. If you have received
> > > the message in error, be informed that any use of the content hereof
> > > is prohibited. Please return it immediately to the sender and delete
> > > the message. Should you have any questions, please send an e_mail to
> > > [EMAIL PROTECTED] Thank you
> > > ====================================================================
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> > --
> > James Stauffer
> > Are you good? Take the test at http://www.livingwaters.com/good/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> > Gruppo Telecom Italia - Direzione e coordinamento di Telecom Italia S.p.A.
> >
> > ====================================================================
> > CONFIDENTIALITY NOTICE
> > This message and its attachments are addressed solely to the persons
> > above and may contain confidential information. If you have received
> > the message in error, be informed that any use of the content hereof
> > is prohibited. Please return it immediately to the sender and delete
> > the message. Should you have any questions, please send an e_mail to
> > [EMAIL PROTECTED] Thank you
> > ====================================================================
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> James Stauffer
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> Gruppo Telecom Italia - Direzione e coordinamento di Telecom Italia S.p.A.
>
> ====================================================================
> CONFIDENTIALITY NOTICE
> This message and its attachments are addressed solely to the persons
> above and may contain confidential information. If you have received
> the message in error, be informed that any use of the content hereof
> is prohibited. Please return it immediately to the sender and delete
> the message. Should you have any questions, please send an e_mail to
> [EMAIL PROTECTED] Thank you
> ====================================================================
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to