Quoting Pagnin Roberto <[EMAIL PROTECTED]>: > Hi James, I've tried to change levels and removed root logger but no result > changes. > I've done another try, I've removed the second logger from configuration and > modified the application to write to the "survived" logger but same error > appears " Log4j:WARN. No appenders could be...". > I'm thinking about changing logging package to jdk logging one... >
Changing the logging package will do nothing to fix your problem here. You'll have the same problem not finding your config file with any logging system. So, if you have a particular problem with Log4j other than this, go ahead and used JDK1.4 logging. If this is the only issue, it will simply be a change for change sake. The problem won't go away. Now, lets take a look at your script... 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 And take a look at how use the information... PropertyConfigurator.configureAndWatch(args[1],log4jRefreshTime); So, my question is, does log4j.properties exist in the same directory as you started the VM from? Based on the fact that you are getting the message from Log4j that it couldn't find any appenders, I guess the answer is "no, it's somewhere else". Relatively defined file paths are relative to the directory where the VM started. If all else fails, use an absolute file path to avoid confusion. Other than that, why don't you just stick the log4j.properties file in the classpath (in the default package) and let Log4j find it and configure it automatically? Do you really need configureAndWatch()? I would avoid it. It can cause a number of headaches. Search the list for details. Jake > Rob > > -----Messaggio originale----- > Da: James Stauffer [mailto:[EMAIL PROTECTED] > Inviato: venerdì 20 gennaio 2006 20.06 > A: Log4J Users List > Oggetto: Re: R: R: Application with two loggers - The second one doesn't log > anything > > 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] > > > > 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] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
