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 Pagnin Roberto <Ro...@TILAB.COM> on 2006/01/18 18:04:30 UTC
Application with two loggers - The second one doesn't log anything
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
MailAdmin@tilab.com. Thank you
====================================================================
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Application with two loggers - The second one doesn't log anything
Posted by James Stauffer <st...@gmail.com>.
Why is log4j.properties in the command line twice? Do you use
automatic configuration?
On 1/18/06, Pagnin Roberto <Ro...@tilab.com> 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
> MailAdmin@tilab.com. Thank you
> ====================================================================
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
--
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org