From dxxvi at yahoo.com Mon Jan 2 06:31:28 2012 From: dxxvi at yahoo.com (Thai Dang Vu) Date: Sun, 1 Jan 2012 21:31:28 -0800 (PST) Subject: [logback-user] logback in WebLogic 11g/12c Message-ID: <1325482288.91950.YahooMailNeo@web122020.mail.ne1.yahoo.com> Hi All, My application is in an exploded EAR directory which has a war and a jar module. Its directory structure can be seen in the attached fig1.png (where log4j and commons-logging are used) and fig4.png (where logback is used). The application.xml is in fig2.png. The log4j.properties and logback.xml are in the jar module so that other modules (war, ejb) can use it. The servlet (fig3.png) writes to the log. The application works fine with log4j, but nothing is printed out in case of logback. The application is in again.zip. The exploded EAR directory can be generated with running "mvn clean package" in the root directory. Does anybody know where I'm wrong with logback? Regards. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: fig1.png Type: image/png Size: 28531 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: fig2.png Type: image/png Size: 24351 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: fig3.png Type: image/png Size: 40667 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: fig4.png Type: image/png Size: 29386 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: again.zip Type: application/zip Size: 22809 bytes Desc: not available URL: From greg at klout.com Tue Jan 3 20:26:00 2012 From: greg at klout.com (Greg Silin) Date: Tue, 3 Jan 2012 11:26:00 -0800 Subject: [logback-user] Issues configuring GMail appender Message-ID: Hi, I'm trying to setup logback for a fairly simple appender configuration.. DEBUG, INFO, WARN: System.out Console Appender, File Appender ERROR: System.err Console Appender, File Appender, SMTPAppender configured for GMail. Following instructions to setup GMail appender, I have the following: Appender config: smtp.gmail.com 465 true MyUsername MyPassword greg at klout.com noreply at gmail.com LOGGED ERROR: %logger{20} - %m %date %-5level %logger{35} - %message%n%xEx{35} Appender inclusion: All appropriate maven dependencies: logger jars 1.6.4 org.slf4j slf4j-api ${slf4j.version} ch.qos.logback logback-access 1.0.0 ch.qos.logback logback-classic 1.0.0 ch.qos.logback logback-core 1.0.0 java mail javax.mail mail 1.4.4 All the other appenders work just fine as configured. I see that the SMTPAppender is being loaded w/o error (at least nothing I see reported) .. yet on ERROR nothing gets sent. Username & password are all correct. I've confirmed with our operations that we don't have any special spam filters set up. Thoughts on what could be wrong / what I need to check? Thanks -greg -------------- next part -------------- An HTML attachment was scrubbed... URL: From n.amir.jamil at gmail.com Wed Jan 4 10:42:22 2012 From: n.amir.jamil at gmail.com (Noman Amir Jamil) Date: Wed, 4 Jan 2012 13:42:22 +0400 Subject: [logback-user] Are special charcters allowed in logger configurations? Message-ID: Hi, I would like to know if the following issue is resolved in logback, it was previously encountered in log4j: "there are known issues with using this naming convention (with square brackets) in log4j XML based configuration files" I am using a similar configuration with square brackets: logger name="org.apache.catalina.core.ContainerBase.[Catalina].[localhost]" level="INFO" additivity="false"> But it appears that the portion after ContainerBase is being ignored or not processed. I would really appreciate any help on this. Thanks Noman A. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cinhtau at gmail.com Wed Jan 4 11:14:24 2012 From: cinhtau at gmail.com (cinhtau) Date: Wed, 4 Jan 2012 02:14:24 -0800 (PST) Subject: [logback-user] SMTPAppender OSGi-Problem within Glassfish v3.1.1 (Apache Felix) Message-ID: <33078034.post@talk.nabble.com> Hi @all, I try to use SMTPAppender for logging errors to respective users via E-Mail in OSGi. My configuration is: OS: Ubuntu Linux 10.04.03 LTS Application Environment: Glassfish 3.1.1 using Apache Felix Logback: tried logback classic Version 0.29 and current Version 1.0 leading to same results Glassfish has following bundles g! lb mail START LEVEL 10 ID|State |Level|Name 227|Resolved | 1|JavaMail API (1.4.4) I write following BundleActivator (I switch the real addresses with stubs), sending an email via SMTPAppender and Java Mail from scratch. package de.sgbs.log; import java.util.logging.Level; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.Marker; import org.slf4j.MarkerFactory; import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.classic.joran.JoranConfigurator; import ch.qos.logback.core.joran.spi.JoranException; public class Activator implements BundleActivator { private final static Logger logger = LoggerFactory.getLogger(Activator.class); @Override public void start(BundleContext context) throws Exception { try { LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); JoranConfigurator configurator = new JoranConfigurator(); configurator.setContext(lc); lc.reset(); lc.putProperty("application-name", Activator.class.getSimpleName()); configurator.doConfigure("logback.xml"); Marker notifyAdmin = MarkerFactory.getMarker("NOTIFY_ADMIN"); logger.error(notifyAdmin, "This is a serious an error requiring the admin's attention", new Exception("Just testing")); } catch (JoranException ex) { java.util.logging.Logger.getLogger(Activator.class.getName()).log(Level.SEVERE, null, ex); } sendEMail(); } private void sendEMail() throws MessagingException { java.util.Properties props = new java.util.Properties(); props.put("mail.smtp.host", "smtp"); props.put("mail.smtp.port", "25"); Session session = Session.getDefaultInstance(props, null); // Construct the message Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress("me at gmail.com")); msg.setRecipient(Message.RecipientType.TO, new InternetAddress("foo at bar.com")); msg.setSubject("Test"); msg.setText("Hello user, you got an error:"); // Send the message Transport.send(msg); } @Override public void stop(BundleContext context) { logger.info("Goodbye Community!"); } } My logback.xml NOTIFY_ADMIN TRANSACTION_FAILURE smtp foo at bar.com me at gmail.com TESTING: %logger{20} - %m %date %-5level %logger{35} - %message%n Sending from scratch works. SMTPAppender raises an error. This error is given on the osgi console: 10:14:46,850 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [EMAIL] to Logger[ROOT] 10:14:47,048 |-ERROR in ch.qos.logback.classic.net.SMTPAppender[EMAIL] - Error occured while sending e-mail notification. javax.mail.MessagingException: IOException while sending message; nested exception is: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed; boundary="----=_Part_5_17758761.1325668486851" at javax.mail.MessagingException: IOException while sending message at at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1141) at at javax.mail.Transport.send0(Transport.java:195) at at javax.mail.Transport.send(Transport.java:124) at at ch.qos.logback.core.net.SMTPAppenderBase.sendBuffer(SMTPAppenderBase.java:343) at at ch.qos.logback.core.net.SMTPAppenderBase.append(SMTPAppenderBase.java:179) at at ch.qos.logback.core.AppenderBase.doAppend(AppenderBase.java:85) at at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:64) at at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:285) at at ch.qos.logback.classic.Logger.callAppenders(Logger.java:272) at at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:473) at at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:427) at at ch.qos.logback.classic.Logger.error(Logger.java:610) at at de.sgbs.log.Activator.start(Activator.java:37) at at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:629) ... Caused by: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed; boundary="----=_Part_5_17758761.1325668486851" at at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:877) at at javax.activation.DataHandler.writeTo(DataHandler.java:302) at at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1476) at at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1772) at at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1099) at ... 47 common frames omitted 10:14:47,049 |-INFO in ch.qos.logback.classic.net.SMTPAppender[EMAIL] - SMTPAppender [EMAIL] is tracking [1] buffers First I thought MIME type multipart/mixed is the cause. I checked my SMTP Server Settings, sending email is ok. I tried googlemail. It's working too. I found another https://bugs.eclipse.org/bugs/show_bug.cgi?id=322398 resource with the same error message. Could it be an classloader problem? Could someone help me to pinpoint the problem? Thanks in advance. -- View this message in context: http://old.nabble.com/SMTPAppender-OSGi-Problem-within-Glassfish-v3.1.1-%28Apache-Felix%29-tp33078034p33078034.html Sent from the Logback User mailing list archive at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony19 at gmail.com Wed Jan 4 12:38:19 2012 From: tony19 at gmail.com (Tony Trinh) Date: Wed, 4 Jan 2012 06:38:19 -0500 Subject: [logback-user] Are special charcters allowed in logger configurations? In-Reply-To: References: Message-ID: I just tried logback.xml with square brackets in the logger name and didn't see any apparent problems (the logger printed log statements as expected). -Tony On Wed, Jan 4, 2012 at 4:42 AM, Noman Amir Jamil wrote: > Hi, > > I would like to know if the following issue is resolved in logback, it was > previously encountered in log4j: > > "there are known issues with using this naming convention (with square > brackets) in log4j XML based configuration files" > > I am using a similar configuration with square brackets: > > logger > name="org.apache.catalina.core.ContainerBase.[Catalina].[localhost]" > level="INFO" additivity="false"> > > But it appears that the portion after ContainerBase is being ignored or > not processed. > > I would really appreciate any help on this. > > Thanks > Noman A. > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From n.amir.jamil at gmail.com Wed Jan 4 12:56:16 2012 From: n.amir.jamil at gmail.com (Noman Amir Jamil) Date: Wed, 4 Jan 2012 15:56:16 +0400 Subject: [logback-user] Are special charcters allowed in logger configurations? In-Reply-To: References: Message-ID: Thanks for the reply Tony, I am glad to know it works and the issue is not with the square brackets then. Could it be my appender/logger configuration then? The situation is, under normal configuration [tomcat's juli logging], my my webapps writes separately to catalina.log and localhost.log. But when I configure logback, the catalina.log only has tomcat logging and all my webapps loggings ends up in localhost.log. Below is my logback.xml: ======================================================== %d{HH:mm:ss.SSS} %-5level {%thread} [%logger{20}] : %msg%n ${catalina.base}/logs/catalina.log true utf-8 %date{"MMM dd, yyyy HH:mm:ss a"} %C %n%level: %msg%n ${catalina.base}/logs/catalina-%d{yyyyMMdd}-%i.log.zip 1 10KB ${catalina.base}/logs/localhost.log true utf-8 %date{"MMM dd, yyyy HH:mm:ss a"} %c %n%level : %msg%n ${catalina.base}/logs/localhost-%d{yyyyMMdd}-%i.log.zip 60 10KB ======================================================== This is on Windows Server 2008, Tomcat6. Can you suggest anything to rectify this? Thanks Noman A. On Wed, Jan 4, 2012 at 3:38 PM, Tony Trinh wrote: > I just tried logback.xml with square brackets in the logger name and > didn't see any apparent problems (the logger printed log statements as > expected). > > -Tony > > On Wed, Jan 4, 2012 at 4:42 AM, Noman Amir Jamil wrote: > >> Hi, >> >> I would like to know if the following issue is resolved in logback, it >> was previously encountered in log4j: >> >> "there are known issues with using this naming convention (with square >> brackets) in log4j XML based configuration files" >> >> I am using a similar configuration with square brackets: >> >> logger >> name="org.apache.catalina.core.ContainerBase.[Catalina].[localhost]" >> level="INFO" additivity="false"> >> >> But it appears that the portion after ContainerBase is being ignored or >> not processed. >> >> I would really appreciate any help on this. >> >> Thanks >> Noman A. >> >> _______________________________________________ >> Logback-user mailing list >> Logback-user at qos.ch >> http://mailman.qos.ch/mailman/listinfo/logback-user >> > > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From thunderaxiom at hotmail.com Wed Jan 4 12:58:45 2012 From: thunderaxiom at hotmail.com (=?iso-8859-1?Q?Thorbj=F8rn_Ravn_Andersen?=) Date: Wed, 4 Jan 2012 12:58:45 +0100 Subject: [logback-user] SMTPAppender OSGi-Problem within Glassfish v3.1.1 (Apache Felix) In-Reply-To: <33078034.post@talk.nabble.com> References: <33078034.post@talk.nabble.com> Message-ID: I did a google search for the exception text and found that this problem has been reported by others. You might find http://stackoverflow.com/questions/1969667/send-a-mail-from-java5-and-java6 relevant. /Thorbj?rn From: logback-user-bounces at qos.ch [mailto:logback-user-bounces at qos.ch] On Behalf Of cinhtau Sent: 4. januar 2012 11:14 To: logback-user at qos.ch Subject: [logback-user] SMTPAppender OSGi-Problem within Glassfish v3.1.1 (Apache Felix) Hi @all, I try to use SMTPAppender for logging errors to respective users via E-Mail in OSGi. My configuration is: * OS: Ubuntu Linux 10.04.03 LTS * Application Environment: Glassfish 3.1.1 using Apache Felix * Logback: tried logback classic Version 0.29 and current Version 1.0 leading to same results Glassfish has following bundles g! lb mail START LEVEL 10 ID|State |Level|Name 227|Resolved | 1|JavaMail API (1.4.4) I write following BundleActivator (I switch the real addresses with stubs), sending an email via SMTPAppender and Java Mail from scratch. package de.sgbs.log; import java.util.logging.Level; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.Marker; import org.slf4j.MarkerFactory; import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.classic.joran.JoranConfigurator; import ch.qos.logback.core.joran.spi.JoranException; public class Activator implements BundleActivator { private final static Logger logger = LoggerFactory.getLogger(Activator.class); @Override public void start(BundleContext context) throws Exception { try { LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); JoranConfigurator configurator = new JoranConfigurator(); configurator.setContext(lc); lc.reset(); lc.putProperty("application-name", Activator.class.getSimpleName()); configurator.doConfigure("logback.xml"); Marker notifyAdmin = MarkerFactory.getMarker("NOTIFY_ADMIN"); logger.error(notifyAdmin, "This is a serious an error requiring the admin's attention", new Exception("Just testing")); } catch (JoranException ex) { java.util.logging.Logger.getLogger(Activator.class.getName()).log(Level.SEVE RE, null, ex); } sendEMail(); } private void sendEMail() throws MessagingException { java.util.Properties props = new java.util.Properties(); props.put("mail.smtp.host", "smtp"); props.put("mail.smtp.port", "25"); Session session = Session.getDefaultInstance(props, null); // Construct the message Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress("me at gmail.com")); msg.setRecipient(Message.RecipientType.TO, new InternetAddress("foo at bar.com")); msg.setSubject("Test"); msg.setText("Hello user, you got an error:"); // Send the message Transport.send(msg); } @Override public void stop(BundleContext context) { logger.info("Goodbye Community!"); } } My logback.xml NOTIFY_ADMIN TRANSACTION_FAILURE smtp foo at bar.com me at gmail.com TESTING: %logger{20} - %m %date %-5level %logger{35} - %message%n Sending from scratch works. SMTPAppender raises an error. This error is given on the osgi console: 10:14:46,850 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [EMAIL] to Logger[ROOT] 10:14:47,048 |-ERROR in ch.qos.logback.classic.net.SMTPAppender[EMAIL] - Error occured while sending e-mail notification. javax.mail.MessagingException: IOException while sending message; nested exception is: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed; boundary="----=_Part_5_17758761.1325668486851" at javax.mail.MessagingException: IOException while sending message at at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1141) at at javax.mail.Transport.send0(Transport.java:195) at at javax.mail.Transport.send(Transport.java:124) at at ch.qos.logback.core.net.SMTPAppenderBase.sendBuffer(SMTPAppenderBase.java:34 3) at at ch.qos.logback.core.net.SMTPAppenderBase.append(SMTPAppenderBase.java:179) at at ch.qos.logback.core.AppenderBase.doAppend(AppenderBase.java:85) at at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(Appende rAttachableImpl.java:64) at at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:285) at at ch.qos.logback.classic.Logger.callAppenders(Logger.java:272) at at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:473) at at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:427) at at ch.qos.logback.classic.Logger.error(Logger.java:610) at at de.sgbs.log.Activator.start(Activator.java:37) at at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.jav a:629) ... Caused by: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed; boundary="----=_Part_5_17758761.1325668486851" at at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:877) at at javax.activation.DataHandler.writeTo(DataHandler.java:302) at at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1476) at at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1772) at at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1099) at ... 47 common frames omitted 10:14:47,049 |-INFO in ch.qos.logback.classic.net.SMTPAppender[EMAIL] - SMTPAppender [EMAIL] is tracking [1] buffers First I thought MIME type multipart/mixed is the cause. I checked my SMTP Server Settings, sending email is ok. I tried googlemail. It's working too. I found another resource with the same error message. Could it be an classloader problem? Could someone help me to pinpoint the problem? Thanks in advance. _____ View this message in context: SMTPAppender OSGi-Problem within Glassfish v3.1.1 (Apache Felix) Sent from the Logback User mailing list archive at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cinhtau at gmail.com Wed Jan 4 15:03:04 2012 From: cinhtau at gmail.com (cinhtau) Date: Wed, 4 Jan 2012 06:03:04 -0800 (PST) Subject: [logback-user] SMTPAppender OSGi-Problem within Glassfish v3.1.1 (Apache Felix) In-Reply-To: References: <33078034.post@talk.nabble.com> Message-ID: <33079255.post@talk.nabble.com> Thorbj?rn Ravn Andersen-4 wrote: > > I did a google search for the exception text and found that this problem > has > been reported by others. You might find > > http://stackoverflow.com/questions/1969667/send-a-mail-from-java5-and-java6 > relevant. > > Thorbj?rn > Thank you. But this isn't the core problem I add the option -Djavax.activation.debug=true and this is printed out.
14:57:55,872 |-INFO in ch.qos.logback.classic.net.SMTPAppender[EMAIL] -
SMTPAppender [EMAIL] is tracking [1] buffers
MailcapCommandMap: createDataContentHandler for text/plain
  search DB #1
  search fallback DB #1
MailcapCommandMap: createDataContentHandler for text/plain
  search DB #1
  search fallback DB #1
MailcapCommandMap: createDataContentHandler for multipart/mixed
  search DB #1
  search fallback DB #1
14:57:55,913 |-ERROR in ch.qos.logback.classic.net.SMTPAppender[EMAIL] -
Error occurred while sending e-mail notification.
javax.mail.MessagingException: IOException while sending message;
  nested exception is:
	javax.activation.UnsupportedDataTypeException: no object DCH for MIME type
multipart/mixed; 
	boundary="----=_Part_4_29409898.1325685475873"
	at javax.mail.MessagingException: IOException while sending message
	at 	at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1141)
	at 	at javax.mail.Transport.send0(Transport.java:195)
	at 	at javax.mail.Transport.send(Transport.java:124)
	at 	at
ch.qos.logback.core.net.SMTPAppenderBase.sendBuffer(SMTPAppenderBase.java:352)
	at 	at
ch.qos.logback.core.net.SMTPAppenderBase$SenderRunnable.run(SMTPAppenderBase.java:600)
	at 	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at 	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at 	at java.lang.Thread.run(Thread.java:662)
Caused by: javax.activation.UnsupportedDataTypeException: no object DCH for
MIME type multipart/mixed; 
	boundary="----=_Part_4_29409898.1325685475873"
	at 	at
javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:877)
	at 	at javax.activation.DataHandler.writeTo(DataHandler.java:302)
	at 	at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1476)
	at 	at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1772)
	at 	at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1099)
	at 	... 7 common frames omitted
As I told, sending from scratch is ok. If I use SMTPAppender it might be a classloading problem of SMTPAppender, or at least I assume it. Have to look at the source (ch.qos.logback.core.net.SMTPAppenderBase.sendBuffer(SMTPAppenderBase.java:352)) then. -- View this message in context: http://old.nabble.com/SMTPAppender-OSGi-Problem-within-Glassfish-v3.1.1-%28Apache-Felix%29-tp33078034p33079255.html Sent from the Logback User mailing list archive at Nabble.com. From tony19 at gmail.com Wed Jan 4 15:17:44 2012 From: tony19 at gmail.com (Tony Trinh) Date: Wed, 4 Jan 2012 09:17:44 -0500 Subject: [logback-user] Are special charcters allowed in logger configurations? In-Reply-To: References: Message-ID: I'm not all that familiar with org.apache.juli, but your appender class names look bizarre to me. For instance: org.apache.juli.logging.ch.qos.logback.core.rolling.RollingFileAppender I think that should be: ch.qos.logback.core.rolling.RollingFileAppender Or is this intentional? -Tony On Wed, Jan 4, 2012 at 6:56 AM, Noman Amir Jamil wrote: > org.apache.juli.logging > -------------- next part -------------- An HTML attachment was scrubbed... URL: From n.amir.jamil at gmail.com Wed Jan 4 15:33:31 2012 From: n.amir.jamil at gmail.com (Noman Amir Jamil) Date: Wed, 4 Jan 2012 18:33:31 +0400 Subject: [logback-user] Are special charcters allowed in logger configurations? In-Reply-To: References: Message-ID: Yes Tony, because I am using the tomcat-jul-sl4j-logback setup as described here : https://github.com/grgrzybek/tomcat-slf4j-logback -Noman A. On Wed, Jan 4, 2012 at 6:17 PM, Tony Trinh wrote: > I'm not all that familiar with org.apache.juli, but your appender class > names look bizarre to me. For instance: > > org.apache.juli.logging.ch.qos.logback.core.rolling.RollingFileAppender > > > I think that should be: > > ch.qos.logback.core.rolling.RollingFileAppender > > > Or is this intentional? > > -Tony > > On Wed, Jan 4, 2012 at 6:56 AM, Noman Amir Jamil wrote: > >> org.apache.juli.logging >> > > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ceki at qos.ch Wed Jan 4 15:55:24 2012 From: ceki at qos.ch (ceki) Date: Wed, 04 Jan 2012 15:55:24 +0100 Subject: [logback-user] Issues configuring GMail appender In-Reply-To: References: Message-ID: <4F04685C.9030100@qos.ch> Hello Greg, Add the following line to your logback.xml config file to see the error message output when SMTPAppender sends out a message. For more info on OnConsoleStatusListener see [1]. By the way, you should not declare logback-access as a dependency if you are not using logback-access. HTH, -- Ceki [1] http://logback.qos.ch/manual/configuration.html#statusListener On 03.01.2012 20:26, Greg Silin wrote: > Hi, > > I'm trying to setup logback for a fairly simple appender configuration.. > > DEBUG, INFO, WARN: System.out Console Appender, File Appender > ERROR: System.err Console Appender, File Appender, SMTPAppender > configured for GMail. > > Following instructions to setup GMail appender, I have the following: > > Appender config: > > > class="ch.qos.logback.classic.net.SMTPAppender"> > smtp.gmail.com > 465 > true > MyUsername > MyPassword > > greg at klout.com > > noreply at gmail.com > LOGGED ERROR: %logger{20} - %m > > %date %-5level %logger{35} - %message%n%xEx{35} > > > > Appender inclusion: > > > > > > > > All appropriate maven dependencies: > > logger jars > > 1.6.4 > > > org.slf4j > slf4j-api > ${slf4j.version} > > > ch.qos.logback > logback-access > 1.0.0 > > > ch.qos.logback > logback-classic > 1.0.0 > > > ch.qos.logback > logback-core > 1.0.0 > > > > java mail > > javax.mail > mail > 1.4.4 > > > > All the other appenders work just fine as configured. I see that the > SMTPAppender is being loaded w/o error (at least nothing I see reported) > .. yet on ERROR nothing gets sent. Username & password are all correct. > I've confirmed with our operations that we don't have any special spam > filters set up. > > Thoughts on what could be wrong / what I need to check? > > Thanks > -greg > > From gnormington at vmware.com Thu Jan 5 13:09:49 2012 From: gnormington at vmware.com (Glyn Normington) Date: Thu, 5 Jan 2012 12:09:49 +0000 Subject: [logback-user] JaninoEventEvaluator and class loader Message-ID: <083F7655-55FA-4E7D-A84B-B6D1A424891F@vmware.com> I am attempting to get Janino 2.6.1 working with Logback 0.9.28 (or later, but that's the version we are using in Eclipse Virgo right now) - see [0] for background. Unfortunately Janino ends up using the thread context class loader as its "parent" class loader and fails with a runtime exception. I have discussed this ([1]) on the Janino mailing list and it seems that it is necessary to set the parent class loader in Janino. I am somewhat at the mercy of Logback here. The surprising thing is that the code in Logback 0.9.24 looked pretty usable in this respect. JaninoEventEvaluator.start had the following sequence: ClassLoader cl = context.getClass().getClassLoader(); ee = new ExpressionEvaluator(getDecoratedExpression(), EXPRESSION_TYPE, getParameterNames(), getParameterTypes(), THROWN_EXCEPTIONS, cl); thus setting the parent class loader to a value which I could ensure would be capable of loading the necessary types. In 0.9.28 this code has been replaced by: scriptEvaluator = new ScriptEvaluator(getDecoratedExpression(), EXPRESSION_TYPE, getParameterNames(), getParameterTypes(), THROWN_EXCEPTIONS); which causes the current TCCL to be used as the parent class loader and ultimately results in Janino failing. I can't control the TCCL that happens to be in use when start is called as that is driven out of a logging call which can come from an arbitrary thread. I found the relevant commit ([2]), but I can't tell from that why this specific change was made. If it is absolutely necessary to use ScriptEvaluator rather than ExpressionEvaluator, the following code sequence (based on a suggestion from Arno Unkrig) would reproduce the parent class loader behaviour of 0.9.24: ClassLoader cl = context.getClass().getClassLoader(); scriptEvaluator = new ScriptEvaluator(); scriptEvaluator.setParentClassLoader(cl); scriptEvaluator.setReturnType(EXPRESSION_TYPE); scriptEvaluator.setParameterNames(getParameterNames()); scriptEvaluator.setParameterTypes(getParameterTypes()); scriptEvaluator.setThrownExceptions(THROWN_EXCEPTIONS); scriptEvaluator.cook(getDecoratedExpression()); The alternative of using ExpressionEvaluator is much neater and seems to be close to the ScriptEvaluator variant since ExpressionEvaluator extends ScriptEvaluator. Any suggestions gratefully received. Regards, Glyn [0] https://bugs.eclipse.org/bugs/show_bug.cgi?id=333920 [1] mailing list archive link currently broken - if I can get a link to it, I'll post this later [2] https://github.com/ceki/logback/commit/06a5b692f14560636bd92d7bd7cf1f85830f4e55#diff-4 -------------- next part -------------- An HTML attachment was scrubbed... URL: From ceki at qos.ch Thu Jan 5 23:47:05 2012 From: ceki at qos.ch (ceki) Date: Thu, 05 Jan 2012 23:47:05 +0100 Subject: [logback-user] JaninoEventEvaluator and class loader In-Reply-To: <083F7655-55FA-4E7D-A84B-B6D1A424891F@vmware.com> References: <083F7655-55FA-4E7D-A84B-B6D1A424891F@vmware.com> Message-ID: <4F062869.504@qos.ch> Hi Glyn, We started moved away from ExpressionEvaluator and started using ScriptEvaluator because the latter allows for java blocks whereas the former allows only boolean expressions. The ability to parse java blocks reduces the ease-of-use gap between JaninoEvaluator and GEvaluator. See also: http://mailman.qos.ch/pipermail/logback-user/2011-January/002002.html Class loading issues were not taken into consideration when making this change. More in line. On 05.01.2012 13:09, Glyn Normington wrote: > I am attempting to get Janino 2.6.1 working with Logback 0.9.28 (or > later, but that's the version we are using in Eclipse Virgo right now) - > see [0] for background. Unfortunately Janino ends up using the thread > context class loader as its "parent" class loader and fails with a > runtime exception. I have discussed this ([1]) on the Janino mailing > list and it seems that it is necessary to set the parent class loader in > Janino. I am somewhat at the mercy of Logback here. OK. > The surprising thing is that the code in Logback 0.9.24 looked pretty > usable in this respect. JaninoEventEvaluator.start had the following > sequence: > > ClassLoader cl = context.getClass().getClassLoader(); > ee = new ExpressionEvaluator(getDecoratedExpression(), EXPRESSION_TYPE, > getParameterNames(), getParameterTypes(), THROWN_EXCEPTIONS, cl); > > thus setting the parent class loader to a value which I could ensure > would be capable of loading the necessary types. > > In 0.9.28 this code has been replaced by: > > scriptEvaluator = new ScriptEvaluator(getDecoratedExpression(), > EXPRESSION_TYPE, > getParameterNames(), getParameterTypes(), THROWN_EXCEPTIONS); > > which causes the current TCCL to be used as the parent class loader and > ultimately results in Janino failing. Well, as mentioned above, class loading issues were not taken into consideration when making the change. I was not aware that ScriptEvaluator used the TCCL by default. > I can't control the TCCL that happens to be in use when start is called > as that is driven out of a logging call which can come from an arbitrary > thread. Right. > I found the relevant commit ([2]), but I can't tell from that why this > specific change was made. Explanation give above. > If it is absolutely necessary to use ScriptEvaluator rather than > ExpressionEvaluator, the following code sequence (based on a suggestion > from Arno Unkrig) would reproduce the parent class loader behaviour of > 0.9.24: > > ClassLoader cl = context.getClass().getClassLoader(); > scriptEvaluator = new ScriptEvaluator(); > scriptEvaluator.setParentClassLoader(cl); > scriptEvaluator.setReturnType(EXPRESSION_TYPE); > scriptEvaluator.setParameterNames(getParameterNames()); > scriptEvaluator.setParameterTypes(getParameterTypes()); > scriptEvaluator.setThrownExceptions(THROWN_EXCEPTIONS); > scriptEvaluator.cook(getDecoratedExpression()); The above looks good to me. Please create a jira issue requesting for the above change. A reference to this message should provide the relevant context for the jira issue. > The alternative of using ExpressionEvaluator is much neater and seems to > be close to the ScriptEvaluator variant since ExpressionEvaluator > extends ScriptEvaluator. AFAIK, only ScriptEvaluator parses java blocks. ExpressionEvaluator does not. > Any suggestions gratefully received. I would not mind if in addition to the jira issue you could also apply and then test the approach suggested by Arno Unkrig, culminating in git pull request. Yay! > Regards, > Glyn > [0] https://bugs.eclipse.org/bugs/show_bug.cgi?id=333920 > [1] mailing list archive link currently broken - if I can get a link to > it, I'll post this later > [2] > https://github.com/ceki/logback/commit/06a5b692f14560636bd92d7bd7cf1f85830f4e55#diff-4 > -- Ceki http://twitter.com/#!/ceki From gnormington at vmware.com Fri Jan 6 10:27:41 2012 From: gnormington at vmware.com (Glyn Normington) Date: Fri, 6 Jan 2012 09:27:41 +0000 Subject: [logback-user] JaninoEventEvaluator and class loader In-Reply-To: <4F062869.504@qos.ch> References: <083F7655-55FA-4E7D-A84B-B6D1A424891F@vmware.com> <4F062869.504@qos.ch> Message-ID: Hi Ceki Thanks for the detailed response! I raised LBCORE-244 and I'll definitely take a look at providing a patch as it would be good to validate the change under Virgo before it goes in. The gating factor will be how easy it is to build logback core, but I'm optimistic. Regards, Glyn On 5 Jan 2012, at 22:47, ceki wrote: > Hi Glyn, > > We started moved away from ExpressionEvaluator and started using ScriptEvaluator because the latter allows for java blocks whereas the former allows only boolean expressions. The ability to parse java blocks reduces the ease-of-use gap between JaninoEvaluator and GEvaluator. See also: > http://mailman.qos.ch/pipermail/logback-user/2011-January/002002.html > > Class loading issues were not taken into consideration when making this change. > > More in line. > > On 05.01.2012 13:09, Glyn Normington wrote: >> I am attempting to get Janino 2.6.1 working with Logback 0.9.28 (or >> later, but that's the version we are using in Eclipse Virgo right now) - >> see [0] for background. Unfortunately Janino ends up using the thread >> context class loader as its "parent" class loader and fails with a >> runtime exception. I have discussed this ([1]) on the Janino mailing >> list and it seems that it is necessary to set the parent class loader in >> Janino. I am somewhat at the mercy of Logback here. > > OK. > >> The surprising thing is that the code in Logback 0.9.24 looked pretty >> usable in this respect. JaninoEventEvaluator.start had the following >> sequence: >> >> ClassLoader cl = context.getClass().getClassLoader(); >> ee = new ExpressionEvaluator(getDecoratedExpression(), EXPRESSION_TYPE, >> getParameterNames(), getParameterTypes(), THROWN_EXCEPTIONS, cl); >> >> thus setting the parent class loader to a value which I could ensure >> would be capable of loading the necessary types. >> >> In 0.9.28 this code has been replaced by: >> >> scriptEvaluator = new ScriptEvaluator(getDecoratedExpression(), >> EXPRESSION_TYPE, >> getParameterNames(), getParameterTypes(), THROWN_EXCEPTIONS); >> >> which causes the current TCCL to be used as the parent class loader and >> ultimately results in Janino failing. > > Well, as mentioned above, class loading issues were not taken into consideration when making the change. I was not aware that ScriptEvaluator used the TCCL by default. > >> I can't control the TCCL that happens to be in use when start is called >> as that is driven out of a logging call which can come from an arbitrary >> thread. > > Right. > >> I found the relevant commit ([2]), but I can't tell from that why this >> specific change was made. > > Explanation give above. > >> If it is absolutely necessary to use ScriptEvaluator rather than >> ExpressionEvaluator, the following code sequence (based on a suggestion >> from Arno Unkrig) would reproduce the parent class loader behaviour of >> 0.9.24: >> >> ClassLoader cl = context.getClass().getClassLoader(); >> scriptEvaluator = new ScriptEvaluator(); >> scriptEvaluator.setParentClassLoader(cl); >> scriptEvaluator.setReturnType(EXPRESSION_TYPE); >> scriptEvaluator.setParameterNames(getParameterNames()); >> scriptEvaluator.setParameterTypes(getParameterTypes()); >> scriptEvaluator.setThrownExceptions(THROWN_EXCEPTIONS); >> scriptEvaluator.cook(getDecoratedExpression()); > > The above looks good to me. Please create a jira issue requesting for the above change. A reference to this message should provide the relevant context for the jira issue. > >> The alternative of using ExpressionEvaluator is much neater and seems to >> be close to the ScriptEvaluator variant since ExpressionEvaluator >> extends ScriptEvaluator. > > AFAIK, only ScriptEvaluator parses java blocks. ExpressionEvaluator does not. > >> Any suggestions gratefully received. > > I would not mind if in addition to the jira issue you could also apply and then test the approach suggested by Arno Unkrig, culminating in git pull request. Yay! > >> Regards, >> Glyn >> [0] https://bugs.eclipse.org/bugs/show_bug.cgi?id=333920 >> [1] mailing list archive link currently broken - if I can get a link to >> it, I'll post this later >> [2] >> https://github.com/ceki/logback/commit/06a5b692f14560636bd92d7bd7cf1f85830f4e55#diff-4 >> > > > -- > Ceki > http://twitter.com/#!/ceki > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user From matt at traveltripper.com Fri Jan 6 19:53:52 2012 From: matt at traveltripper.com (Matt Bertolini) Date: Fri, 6 Jan 2012 13:53:52 -0500 Subject: [logback-user] Log Messages duplicate when running unit tests. Message-ID: Hello. I am trying to implement logback/slf4j and an extremely frustrating thing is occurring when I run my unit tests. All of the log messages are being duplicated. I am aware of the whole additive nature of appenders and I am pretty sure that I am doing things correctly in that regard but the messages continue to duplicate when running unit tests. When I run through a main method, they do not. Here is my configuration and the messages that are displayed when running unit tests. Dependencies I have included (via Ivy): Configuration: example-test %d{HH:mm:ss.SSS} %-5level %logger - %msg%n Log output when running unit tests: 13:44:23,308 |-INFO in ch.qos.logback.classic.joran.action.ContextNameAction - Setting logger context name as [example-test] 13:44:23,308 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender] 13:44:23,313 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT] 13:44:23,344 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 13:44:23,431 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.example] to DEBUG 13:44:23,431 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to WARN 13:44:23,431 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT] 13:44:23,433 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration. 13:44:23.453 INFO com.example.project.service.impl.ExampleClassImpl - This is a test. 13:44:23.466 INFO com.example.project.service.impl.ExampleClassImpl - This is a test. Log output when running under main method: 13:48:16,729 |-INFO in ch.qos.logback.classic.joran.action.ContextNameAction - Setting logger context name as [example-test] 13:48:16,729 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender] 13:48:16,734 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT] 13:48:16,760 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 13:48:16,825 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.example] to DEBUG 13:48:16,825 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to WARN 13:48:16,825 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT] 13:48:16,827 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration. 13:48:16.843 INFO com.example.project.service.impl.ExampleClassImpl - This is a test. I know that the unit tests are picking up my configuration correctly. When I examine my unit test results, I can see that tests are only being run once so I it is not a duplicate execution of the code. Is there anything special I have to do to stop the duplicates when running unit tests? Thanks for your help. --Matt-- -------------- next part -------------- An HTML attachment was scrubbed... URL: From ceki at qos.ch Fri Jan 6 21:55:01 2012 From: ceki at qos.ch (ceki) Date: Fri, 06 Jan 2012 21:55:01 +0100 Subject: [logback-user] Log Messages duplicate when running unit tests. In-Reply-To: References: Message-ID: <4F075FA5.2000909@qos.ch> Hi Matt, Response in line. On 06.01.2012 19:53, Matt Bertolini wrote: > Hello. > > I am trying to implement logback/slf4j and an extremely frustrating > thing is occurring when I run my unit tests. All of the log messages are > being duplicated. I am aware of the whole additive nature of appenders > and I am pretty sure that I am doing things correctly in that regard but > the messages continue to duplicate when running unit tests. When I run > through a main method, they do not. Here is my configuration and the > messages that are displayed when running unit tests. > > Dependencies I have included (via Ivy): > > > > > > Configuration: > > > example-test > > > %d{HH:mm:ss.SSS} %-5level %logger - %msg%n > > > > > > > > > Log output when running unit tests: > > 13:44:23,308 |-INFO in > ch.qos.logback.classic.joran.action.ContextNameAction - Setting logger > context name as [example-test] > 13:44:23,308 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - > About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender] > 13:44:23,313 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - > Naming appender as [STDOUT] > 13:44:23,344 |-INFO in > ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming > default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for > [encoder] property > 13:44:23,431 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction > - Setting level of logger [com.example] to DEBUG > 13:44:23,431 |-INFO in > ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of > ROOT logger to WARN > 13:44:23,431 |-INFO in > ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender > named [STDOUT] to Logger[ROOT] > 13:44:23,433 |-INFO in > ch.qos.logback.classic.joran.action.ConfigurationAction - End of > configuration. > > 13:44:23.453 INFO com.example.project.service.impl.ExampleClassImpl - > This is a test. > 13:44:23.466 INFO com.example.project.service.impl.ExampleClassImpl - > This is a test. Notice that the timestamps, 13:44:23.453 and 13:44:23.466 are different. It really looks like the log statement for "This is a test" is run twice. Have you tried replacing the logger calls with System.out.println as a comparison? > > Log output when running under main method: > > 13:48:16,729 |-INFO in > ch.qos.logback.classic.joran.action.ContextNameAction - Setting logger > context name as [example-test] > 13:48:16,729 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - > About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender] > 13:48:16,734 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - > Naming appender as [STDOUT] > 13:48:16,760 |-INFO in > ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming > default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for > [encoder] property > 13:48:16,825 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction > - Setting level of logger [com.example] to DEBUG > 13:48:16,825 |-INFO in > ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of > ROOT logger to WARN > 13:48:16,825 |-INFO in > ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender > named [STDOUT] to Logger[ROOT] > 13:48:16,827 |-INFO in > ch.qos.logback.classic.joran.action.ConfigurationAction - End of > configuration. > > 13:48:16.843 INFO com.example.project.service.impl.ExampleClassImpl - > This is a test. > > I know that the unit tests are picking up my configuration correctly. > When I examine my unit test results, I can see that tests are only being > run once so I it is not a duplicate execution of the code. Is there > anything special I have to do to stop the duplicates when running unit > tests? Thanks for your help. From what you describe, I think the log statement for "This is a test" is being invoked twice. HTH, > --Matt-- > -- Ceki http://twitter.com/#!/ceki From matt at traveltripper.com Sat Jan 7 00:17:34 2012 From: matt at traveltripper.com (Matt Bertolini) Date: Fri, 6 Jan 2012 18:17:34 -0500 Subject: [logback-user] Log Messages duplicate when running unit tests. In-Reply-To: <4F075FA5.2000909@qos.ch> References: <4F075FA5.2000909@qos.ch> Message-ID: I spent the last 4 hours pouring over my code and I finally found a bug in my ant script related to the code coverage/junit tests. That bug was causing the test to run twice. I apologize for posting on the Logback list when it was clearly my mistake. Thanks for your help. --Matt-- On Fri, Jan 6, 2012 at 3:55 PM, ceki wrote: > Hi Matt, > > Response in line. > > > On 06.01.2012 19:53, Matt Bertolini wrote: > >> Hello. >> >> I am trying to implement logback/slf4j and an extremely frustrating >> thing is occurring when I run my unit tests. All of the log messages are >> being duplicated. I am aware of the whole additive nature of appenders >> and I am pretty sure that I am doing things correctly in that regard but >> the messages continue to duplicate when running unit tests. When I run >> through a main method, they do not. Here is my configuration and the >> messages that are displayed when running unit tests. >> >> Dependencies I have included (via Ivy): >> >> >> >> >> >> Configuration: >> >> >> example-test >> >> >> %d{HH:mm:ss.SSS} %-5level %logger - %msg%n >> >> >> >> >> >> >> >> >> Log output when running unit tests: >> >> 13:44:23,308 |-INFO in >> ch.qos.logback.classic.joran.**action.ContextNameAction - Setting logger >> context name as [example-test] >> 13:44:23,308 |-INFO in ch.qos.logback.core.joran.**action.AppenderAction >> - >> About to instantiate appender of type [ch.qos.logback.core.** >> ConsoleAppender] >> 13:44:23,313 |-INFO in ch.qos.logback.core.joran.**action.AppenderAction >> - >> Naming appender as [STDOUT] >> 13:44:23,344 |-INFO in >> ch.qos.logback.core.joran.**action.NestedComplexPropertyIA - Assuming >> default type [ch.qos.logback.classic.**encoder.PatternLayoutEncoder] for >> [encoder] property >> 13:44:23,431 |-INFO in ch.qos.logback.classic.joran.**action.LoggerAction >> - Setting level of logger [com.example] to DEBUG >> 13:44:23,431 |-INFO in >> ch.qos.logback.classic.joran.**action.RootLoggerAction - Setting level of >> ROOT logger to WARN >> 13:44:23,431 |-INFO in >> ch.qos.logback.core.joran.**action.AppenderRefAction - Attaching appender >> named [STDOUT] to Logger[ROOT] >> 13:44:23,433 |-INFO in >> ch.qos.logback.classic.joran.**action.ConfigurationAction - End of >> configuration. >> >> 13:44:23.453 INFO com.example.project.service.**impl.ExampleClassImpl - >> This is a test. >> 13:44:23.466 INFO com.example.project.service.**impl.ExampleClassImpl - >> This is a test. >> > > Notice that the timestamps, 13:44:23.453 and 13:44:23.466 are different. > It really looks like the log statement for "This is a test" is run twice. > Have you tried replacing the logger calls with System.out.println as a > comparison? > > > >> Log output when running under main method: >> >> 13:48:16,729 |-INFO in >> ch.qos.logback.classic.joran.**action.ContextNameAction - Setting logger >> context name as [example-test] >> 13:48:16,729 |-INFO in ch.qos.logback.core.joran.**action.AppenderAction >> - >> About to instantiate appender of type [ch.qos.logback.core.** >> ConsoleAppender] >> 13:48:16,734 |-INFO in ch.qos.logback.core.joran.**action.AppenderAction >> - >> Naming appender as [STDOUT] >> 13:48:16,760 |-INFO in >> ch.qos.logback.core.joran.**action.NestedComplexPropertyIA - Assuming >> default type [ch.qos.logback.classic.**encoder.PatternLayoutEncoder] for >> [encoder] property >> 13:48:16,825 |-INFO in ch.qos.logback.classic.joran.**action.LoggerAction >> - Setting level of logger [com.example] to DEBUG >> 13:48:16,825 |-INFO in >> ch.qos.logback.classic.joran.**action.RootLoggerAction - Setting level of >> ROOT logger to WARN >> 13:48:16,825 |-INFO in >> ch.qos.logback.core.joran.**action.AppenderRefAction - Attaching appender >> named [STDOUT] to Logger[ROOT] >> 13:48:16,827 |-INFO in >> ch.qos.logback.classic.joran.**action.ConfigurationAction - End of >> configuration. >> >> 13:48:16.843 INFO com.example.project.service.**impl.ExampleClassImpl - >> This is a test. >> >> I know that the unit tests are picking up my configuration correctly. >> When I examine my unit test results, I can see that tests are only being >> run once so I it is not a duplicate execution of the code. Is there >> anything special I have to do to stop the duplicates when running unit >> tests? Thanks for your help. >> > > From what you describe, I think the log statement for "This is a test" is > being invoked twice. > > HTH, > > --Matt-- >> >> > -- > Ceki > http://twitter.com/#!/ceki > ______________________________**_________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/**listinfo/logback-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gnormington at vmware.com Mon Jan 9 10:17:18 2012 From: gnormington at vmware.com (Glyn Normington) Date: Mon, 9 Jan 2012 09:17:18 +0000 Subject: [logback-user] JaninoEventEvaluator and class loader In-Reply-To: <4F09E55B.4040603@unkrig.de> References: <083F7655-55FA-4E7D-A84B-B6D1A424891F@vmware.com> <4F09E55B.4040603@unkrig.de> Message-ID: Arno kindly fixed the Janino mailing list archive, as promised, so here's the link to my thread there: [1] http://old.nabble.com/Janino-and-OSGi--to33030424.html Regards, Glyn On 8 Jan 2012, at 18:50, Arno Unkrig wrote: > Hi Glyn and everybody else, > > one quick note here: There is no difference between "ScriptEvaluator" and "ExpressionEvaluator" (other than that the former compiles a method body and the latter an expression). Initially, both came with a set of constructors with varying parameter counts and types, but because the configuration possibilities grew over time, the recommended usage pattern is now to call the parameterless constructor, then a series of setters, and then (one of) the "cook()" methods. > > I also wonder why LOGBACK switched from ExpressionEvaluator > > https://github.com/ceki/logback/blob/6c5ba501831d19879e6865f795a1c294ad25bf7d/logback-core/src/main/java/ch/qos/logback/core/boolex/JaninoEventEvaluatorBase.java > > to ScriptEvaluator > > https://github.com/ceki/logback/blob/06a5b692f14560636bd92d7bd7cf1f85830f4e55/logback-core/src/main/java/ch/qos/logback/core/boolex/JaninoEventEvaluatorBase.java > > anyway!? That's a huge semantical change... > > Am 05.01.2012 13:09, schrieb Glyn Normington: >> I am attempting to get Janino 2.6.1 working with Logback 0.9.28 (or >> later, but that's the version we are using in Eclipse Virgo right now) - >> see [0] for background. Unfortunately Janino ends up using the thread >> context class loader as its "parent" class loader and fails with a >> runtime exception. I have discussed this ([1]) on the Janino mailing >> list and it seems that it is necessary to set the parent class loader in >> Janino. I am somewhat at the mercy of Logback here. >> >> The surprising thing is that the code in Logback 0.9.24 looked pretty >> usable in this respect. JaninoEventEvaluator.start had the following >> sequence: >> >> ClassLoader cl = context.getClass().getClassLoader(); >> ee = new ExpressionEvaluator(getDecoratedExpression(), EXPRESSION_TYPE, >> getParameterNames(), getParameterTypes(), THROWN_EXCEPTIONS, cl); >> >> thus setting the parent class loader to a value which I could ensure >> would be capable of loading the necessary types. >> >> In 0.9.28 this code has been replaced by: >> >> scriptEvaluator = new ScriptEvaluator(getDecoratedExpression(), >> EXPRESSION_TYPE, >> getParameterNames(), getParameterTypes(), THROWN_EXCEPTIONS); >> >> which causes the current TCCL to be used as the parent class loader and >> ultimately results in Janino failing. >> >> I can't control the TCCL that happens to be in use when start is called >> as that is driven out of a logging call which can come from an arbitrary >> thread. >> >> I found the relevant commit ([2]), but I can't tell from that why this >> specific change was made. >> >> If it is absolutely necessary to use ScriptEvaluator rather than >> ExpressionEvaluator, the following code sequence (based on a suggestion >> from Arno Unkrig) would reproduce the parent class loader behaviour of >> 0.9.24: >> >> ClassLoader cl = context.getClass().getClassLoader(); >> scriptEvaluator = new ScriptEvaluator(); >> scriptEvaluator.setParentClassLoader(cl); >> scriptEvaluator.setReturnType(EXPRESSION_TYPE); >> scriptEvaluator.setParameterNames(getParameterNames()); >> scriptEvaluator.setParameterTypes(getParameterTypes()); >> scriptEvaluator.setThrownExceptions(THROWN_EXCEPTIONS); >> scriptEvaluator.cook(getDecoratedExpression()); >> >> The alternative of using ExpressionEvaluator is much neater and seems to >> be close to the ScriptEvaluator variant since ExpressionEvaluator >> extends ScriptEvaluator. >> >> Any suggestions gratefully received. >> >> Regards, >> Glyn >> [0] https://bugs.eclipse.org/bugs/show_bug.cgi?id=333920 >> [1] mailing list archive link currently broken - if I can get a link to >> it, I'll post this later >> [2] >> https://github.com/ceki/logback/commit/06a5b692f14560636bd92d7bd7cf1f85830f4e55#diff-4 >> > From gnormington at vmware.com Mon Jan 9 10:22:28 2012 From: gnormington at vmware.com (Glyn Normington) Date: Mon, 9 Jan 2012 09:22:28 +0000 Subject: [logback-user] JaninoEventEvaluator and class loader In-Reply-To: References: <083F7655-55FA-4E7D-A84B-B6D1A424891F@vmware.com> <4F09E55B.4040603@unkrig.de> Message-ID: <1CAF8440-0FE1-4E0C-BE3E-320DAB33A27F@vmware.com> Whoops. I should have written: Arno kindly fixed the Janino mailing list archive, so, as promised, here's the link to my thread there Apologies! Regards, Glyn On 9 Jan 2012, at 09:17, Glyn Normington wrote: > Arno kindly fixed the Janino mailing list archive, as promised, so here's the link to my thread there From christian.wurbs at web.de Mon Jan 9 16:21:04 2012 From: christian.wurbs at web.de (Christian Wurbs) Date: Mon, 9 Jan 2012 16:21:04 +0100 (CET) Subject: [logback-user] How to disable PackagingDataCalculator Message-ID: An HTML attachment was scrubbed... URL: From vhochstein at googlemail.com Wed Jan 11 17:00:35 2012 From: vhochstein at googlemail.com (Volker Hochstein) Date: Wed, 11 Jan 2012 17:00:35 +0100 Subject: [logback-user] appender file name using name of warfile directory Message-ID: Hi, just a quick question. let s assume I ve got a warfile application1 installed to tomcats webapps dir. Do I have the possiblilty to do the following in my appender, without defining any properties of my own? ${catalina.base}/logs/${somehow find out that it is application1 running}.log Basically, if there is a property like catalina.base, which gives me the of the dir in webapps directory? Thanks a lot in adance. -- Volker -------------- next part -------------- An HTML attachment was scrubbed... URL: From james.rogers at tdameritrade.com Wed Jan 11 20:16:44 2012 From: james.rogers at tdameritrade.com (Jim) Date: Wed, 11 Jan 2012 19:16:44 +0000 (UTC) Subject: [logback-user] Class not found exception for LoggingEventVO References: Message-ID: writes: > > I have an application client set up to > send a logging message over ?a bus using a logback JMSQueueAppender. > ?Logback version is 0.9.24 and slf4j version is 1.6.1. I am getting the same error. Did you resolve this issue, and if so how? Thanks, Jim From enrico.spinielli at googlemail.com Thu Jan 12 09:49:56 2012 From: enrico.spinielli at googlemail.com (Enrico Spinielli) Date: Thu, 12 Jan 2012 09:49:56 +0100 Subject: [logback-user] SMTPAppender for android Message-ID: Hi, I am just trying out logback for Android and I was curious about the possibility to use SMTPAppender, but found out it is not included in the features set. Is there any technical reason why this appender is not supported? Or is it just because of "logistics" (aka lack of available effort/time ;-)? Thanks a lot for your feedback Bye -- Enrico Spinielli "Do Androids dream of electric sheep?"? Philip K. Dick "Hear and forget; see and remember;do and understand."?Mitchel Resnick "He who refuses to do arithmetic is doomed to talk nonsense."?John McCarthy From tony19 at gmail.com Thu Jan 12 14:53:00 2012 From: tony19 at gmail.com (Tony Trinh) Date: Thu, 12 Jan 2012 08:53:00 -0500 Subject: [logback-user] SMTPAppender for android In-Reply-To: References: Message-ID: See comments below. On Thu, Jan 12, 2012 at 3:49 AM, Enrico Spinielli < enrico.spinielli at googlemail.com> wrote: > Hi, > I am just trying out logback for Android and I was curious about the > possibility to use SMTPAppender, > but found out it is not included in the features set. > > The SMTPAppender is currently not supported in Android because it requires the javax.mail package, which Android does not support out of the box. Since it's a non-trivial task to add this support, I simply removed this particular appender. > Is there any technical reason why this appender is not supported? > Or is it just because of "logistics" (aka lack of available effort/time > ;-)? > > Indeed, it's lack of time. You can submit a feature request (via an Issue); and/or implement and pull-request it. > Thanks a lot for your feedback > Bye > -- > Enrico Spinielli > "Do Androids dream of electric sheep?"? Philip K. Dick > "Hear and forget; see and remember;do and understand."?Mitchel Resnick > "He who refuses to do arithmetic is doomed to talk nonsense."?John McCarthy > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user -------------- next part -------------- An HTML attachment was scrubbed... URL: From enrico.spinielli at googlemail.com Thu Jan 12 16:52:40 2012 From: enrico.spinielli at googlemail.com (Enrico Spinielli) Date: Thu, 12 Jan 2012 16:52:40 +0100 Subject: [logback-user] SMTPAppender for android In-Reply-To: References: Message-ID: FYI probably using the javamail port to android will make it a simpler task... http://code.google.com/p/javamail-android/ Hope it helps Bye Enrico On Thu, Jan 12, 2012 at 14:53, Tony Trinh wrote: > See comments below. > > On Thu, Jan 12, 2012 at 3:49 AM, Enrico Spinielli > wrote: >> >> Hi, >> I am just trying out logback for Android and I was curious about the >> possibility to use SMTPAppender, >> but found out it is not included in the features set. >> > > The SMTPAppender is currently not supported in Android because it requires > the javax.mail package, which Android does not support out of the box. Since > it's a non-trivial task to add this support, I simply removed this > particular appender. > >> >> Is there any technical reason why this appender is not supported? >> Or is it just because of "logistics" (aka lack of available effort/time >> ;-)? >> > > Indeed, it's lack of time. You can submit a feature request (via an Issue); > and/or implement and pull-request it. > >> >> Thanks a lot for your feedback >> Bye >> -- >> Enrico Spinielli >> "Do Androids dream of electric sheep?"? Philip K. Dick >> "Hear and forget; see and remember;do and understand."?Mitchel Resnick >> "He who refuses to do arithmetic is doomed to talk nonsense."?John >> McCarthy >> _______________________________________________ >> Logback-user mailing list >> Logback-user at qos.ch >> http://mailman.qos.ch/mailman/listinfo/logback-user > > > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user -- Enrico Spinielli "Do Androids dream of electric sheep?"? Philip K. Dick "Hear and forget; see and remember;do and understand."?Mitchel Resnick "He who refuses to do arithmetic is doomed to talk nonsense."?John McCarthy From marco.bresciani at alcatel-lucent.com Fri Jan 13 11:37:06 2012 From: marco.bresciani at alcatel-lucent.com (BRESCIANI, MARCO (MARCO)) Date: Fri, 13 Jan 2012 11:37:06 +0100 Subject: [logback-user] Logging separation with JavaSE Message-ID: <409950F06A2DC442907840DE2D08DF0131D07C38@FRMRSSXCHMBSB2.dc-m.alcatel-lucent.com> Hello all, I've read the logging separation chapter of the manual since my customers (and our tech support) are requiring to separate log file for each "application". Brief description of the application: something like, say, Word: a container application (with a MDC called %X{Server} with a string, say, "Main") plus some different "internal" applications loaded at runtime (with a MDC called %X{Address} being an IP address). When the application starts there is the %X{Server} MDC while when on of the internal applications is loaded by the main one, such application sets the MDC with its own IP. Seems working fine. :) I've been asked to split the log files according to the MDC (because it's "too difficult to use a regexp to filter the file". You know, customers...) and reading the logging separation chapter, I modified my appender: trace/WTPMS.log Into this: trace/${Server}.log And logback creates a file called "Server_IS_UNDEFINED.log", probably because the MDC is set after few (4-5) lines of checks that include a logging entry. Also, setting the MDC, anyway does not create a new file with the new name, even if the "scan" property is true. Any possible solution to this kind of separation? Thanks all, MARCO BRESCIANI ALCATEL-LUCENT Marco.Bresciani at alcatel-lucent.com -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 6553 bytes Desc: not available URL: From manuel.uberti at gmail.com Fri Jan 13 12:47:51 2012 From: manuel.uberti at gmail.com (Manuel Uberti) Date: Fri, 13 Jan 2012 12:47:51 +0100 Subject: [logback-user] Object rendering Message-ID: Hi, I am new to logback, and I was asked to migrate our project from log4j to logback. I was wondering if there's any kind of support for object rendering such as in log4j. This is what we're now doing with log4j. public static LoggerRepository getLoggerRepository() { if (loggerRepository == null) { loggerRepository = org.apache.log4j.LogManager.getLoggerRepository(); } return loggerRepository; } public static RendererSupport getRendererSupport() { LoggerRepository lr = getLoggerRepository(); if ((lr != null) && (lr instanceof RendererSupport)) rendererSupport = (RendererSupport) lr; return rendererSupport; } public static ObjectRender getRendererObject(Class clazz) { ObjectRender renderer = getRendererSupport().getRendererMap().get(clazz); return renderer; } Any thoughts? Thank you, Manuel -------------- next part -------------- An HTML attachment was scrubbed... URL: From MDerr at nycm.com Fri Jan 13 14:54:37 2012 From: MDerr at nycm.com (Merritt H Derr) Date: Fri, 13 Jan 2012 08:54:37 -0500 Subject: [logback-user] Class not found exception for LoggingEventVO In-Reply-To: References: Message-ID: Jim: This was so long ago I'd forgotten about it. I was having this problem in the EJB that was receiving the logged message from the SIB. The final code that handled the message wound up being the following: private void handleMessage(Message msg) { try { TextMessage text = (TextMessage) msg; System.out.println("ServiceUtilityMDB: Input Message = " + text.getText()); System.out.println("End of handling message, no real work done"); } catch (ClassCastException ce) { ILoggingEvent logEvent; try { // Since an exception was thrown trying to treat the arriving // message as text, now try to treat it as an object message. ObjectMessage objMsg = (ObjectMessage) msg; // Grab the LogBack logging event... logEvent = (ILoggingEvent) objMsg.getObject(); // Create a new logger using the logging event name CSGStandardLogger logLocal = new CSGStandardLogger(logEvent .getLoggerName()); // Use the logger callAppenders method to complete the logging tasks logLocal.getLogger().callAppenders(logEvent); } catch (NoClassDefFoundError ncd) { ncd.printStackTrace(); } catch (MessageFormatException mfe) { System.out .println("Message format exception occurred handling message."); mfe.printStackTrace(); } catch (ClassCastException cce) { System.out .println("object msg is not a JmsObjectMessageImpl instance"); } catch (Exception e) { System.out .println("An exception occurred while retrieving the log event message from the queue."); e.printStackTrace(); } } catch (Exception e) { System.out.println("Exception " + e.getMessage()); e.printStackTrace(); } This code is called from the onMessage event in the EJB. The CSGStandardLogger is a Logback logger wrapped by us for specific purposes, but has no magic in it as far as the problem is concerned. Current version of Logback being used is 0.9.28. SLF4J is still at 1.6.1. I've lost the details of all the steps I took, but this code is the result of many searches, iterations of code etc. It works correctly in my environment. Merritt From: Jim To: logback-user at qos.ch Date: 01/11/2012 02:20 PM Subject: Re: [logback-user] Class not found exception for LoggingEventVO Sent by: logback-user-bounces at qos.ch writes: > > I have an application client set up to > send a logging message over a bus using a logback JMSQueueAppender. > Logback version is 0.9.24 and slf4j version is 1.6.1. I am getting the same error. Did you resolve this issue, and if so how? Thanks, Jim _______________________________________________ Logback-user mailing list Logback-user at qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user Join us on Facebook at www.facebook.com/NYCMInsurance. ***CONFIDENTIALITY NOTICE*** This email and any attachments to it are confidential and intended solely for the individual or entity to whom it is addressed. Any unauthorized review, use, disclosure or distribution is prohibited. If you have received this email in error, please contact the sender by reply email and destroy all copies of the original message. From adam.n.gordon at gmail.com Tue Jan 17 21:10:51 2012 From: adam.n.gordon at gmail.com (Adam Gordon) Date: Tue, 17 Jan 2012 13:10:51 -0700 Subject: [logback-user] Custom LayoutWrappingEncoder question Message-ID: I'm using a custom LayoutWrappingEncoder to colorize and selectively timestamp my log file entries. This encoder is configured via the element in my logback XML file. My question is, with a custom encoder, is there a way I can specify a element in my element and use the built in layout patterns? I've tried: [level] - %logger{15}: %message%n x%Ex{full} But I'm seeing the following error in the console when testing that: 13:06:58,318 |-ERROR in ch.qos.logback.classic.PatternLayout("null") - Empty or null pattern. Am I doing this correctly? Thanks, --adam -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam.n.gordon at gmail.com Tue Jan 17 21:25:46 2012 From: adam.n.gordon at gmail.com (adam) Date: Tue, 17 Jan 2012 20:25:46 +0000 (UTC) Subject: [logback-user] Custom LayoutWrappingEncoder question References: Message-ID: that should have read %xEx... - fixed but still same issue. From tony19 at gmail.com Tue Jan 17 21:39:08 2012 From: tony19 at gmail.com (Tony Trinh) Date: Tue, 17 Jan 2012 15:39:08 -0500 Subject: [logback-user] Custom LayoutWrappingEncoder question In-Reply-To: References: Message-ID: See below On Tue, Jan 17, 2012 at 3:10 PM, Adam Gordon wrote: > I'm using a custom LayoutWrappingEncoder to colorize and selectively > timestamp my log file entries. This encoder is configured via the > element in my logback XML file. My question is, with a custom > encoder, is there a way I can specify a element in my > element and use the built in layout patterns? > > I've tried: > > > > [level] - %logger{15}: %message%n x%Ex{full} > > > > I think you're missing the tag. Try this: * *[level] - %logger{15}: %message%n %xEx{full}** > But I'm seeing the following error in the console when testing that: > > 13:06:58,318 |-ERROR in ch.qos.logback.classic.PatternLayout("null") - > Empty or null pattern. > > Am I doing this correctly? > > Thanks, > > --adam > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam.n.gordon at gmail.com Tue Jan 17 22:32:38 2012 From: adam.n.gordon at gmail.com (Adam Gordon) Date: Tue, 17 Jan 2012 14:32:38 -0700 Subject: [logback-user] Custom LayoutWrappingEncoder question In-Reply-To: References: Message-ID: I was missing the element. Adding got rid of the error message, but my output is not being formatted. It's like its ignoring the pattern and layout. --adam http://gordonizer.com On Tue, Jan 17, 2012 at 13:39, Tony Trinh wrote: > See below > > On Tue, Jan 17, 2012 at 3:10 PM, Adam Gordon wrote: > >> I'm using a custom LayoutWrappingEncoder to colorize and selectively >> timestamp my log file entries. This encoder is configured via the >> element in my logback XML file. My question is, with a custom >> encoder, is there a way I can specify a element in my >> element and use the built in layout patterns? >> >> I've tried: >> >> >> >> [level] - %logger{15}: %message%n x%Ex{full} >> >> >> >> > I think you're missing the tag. Try this: > > > > * *[level] - %logger{15}: %message%n %xEx{full}* > * > > > > >> But I'm seeing the following error in the console when testing that: >> >> 13:06:58,318 |-ERROR in ch.qos.logback.classic.PatternLayout("null") - >> Empty or null pattern. >> >> Am I doing this correctly? >> >> Thanks, >> >> --adam >> >> _______________________________________________ >> Logback-user mailing list >> Logback-user at qos.ch >> http://mailman.qos.ch/mailman/listinfo/logback-user >> > > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony19 at gmail.com Wed Jan 18 00:21:15 2012 From: tony19 at gmail.com (Tony Trinh) Date: Tue, 17 Jan 2012 18:21:15 -0500 Subject: [logback-user] Custom LayoutWrappingEncoder question In-Reply-To: References: Message-ID: On Tue, Jan 17, 2012 at 4:32 PM, Adam Gordon wrote: > I was missing the element. Adding got rid of the error message, > but my output is not being formatted. It's like its ignoring the pattern > and layout. > > Including your code and complete logback.xml would be most helpful... What exactly is the outcome? Describe the output (or paste it here). --adam > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam.n.gordon at gmail.com Wed Jan 18 00:41:55 2012 From: adam.n.gordon at gmail.com (Adam Gordon) Date: Tue, 17 Jan 2012 16:41:55 -0700 Subject: [logback-user] Custom LayoutWrappingEncoder question In-Reply-To: References: Message-ID: Of course. Code is available here: https://github.com/icfantv/color-logback The outcome is that it appears that my encoder completely ignores any of the pattern stuff. This leads me to believe I'm supposed to call something in my encoder to do this - I'd assumed that it would happen automatically. --adam http://gordonizer.com On Tue, Jan 17, 2012 at 16:21, Tony Trinh wrote: > On Tue, Jan 17, 2012 at 4:32 PM, Adam Gordon wrote: > >> I was missing the element. Adding got rid of the error >> message, but my output is not being formatted. It's like its ignoring the >> pattern and layout. >> >> > Including your code and complete logback.xml would be most helpful... > What exactly is the outcome? Describe the output (or paste it here). > > --adam >> >> > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony19 at gmail.com Wed Jan 18 02:46:53 2012 From: tony19 at gmail.com (Tony Trinh) Date: Tue, 17 Jan 2012 20:46:53 -0500 Subject: [logback-user] Custom LayoutWrappingEncoder question In-Reply-To: References: Message-ID: There's a bug at line 98. You need to use Layout.doLayout(event) instead of event.getFormattedMessage(). I've commented here . On Tue, Jan 17, 2012 at 6:41 PM, Adam Gordon wrote: > Of course. Code is available here: > https://github.com/icfantv/color-logback > > The outcome is that it appears that my encoder completely ignores any of > the pattern stuff. This leads me to believe I'm supposed to call something > in my encoder to do this - I'd assumed that it would happen automatically. > > --adam > > http://gordonizer.com > > > > On Tue, Jan 17, 2012 at 16:21, Tony Trinh wrote: > >> On Tue, Jan 17, 2012 at 4:32 PM, Adam Gordon wrote: >> >>> I was missing the element. Adding got rid of the error >>> message, but my output is not being formatted. It's like its ignoring the >>> pattern and layout. >>> >>> >> Including your code and complete logback.xml would be most helpful... >> What exactly is the outcome? Describe the output (or paste it here). >> >> --adam >>> >>> >> _______________________________________________ >> Logback-user mailing list >> Logback-user at qos.ch >> http://mailman.qos.ch/mailman/listinfo/logback-user >> > > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam.n.gordon at gmail.com Wed Jan 18 21:30:52 2012 From: adam.n.gordon at gmail.com (Adam Gordon) Date: Wed, 18 Jan 2012 13:30:52 -0700 Subject: [logback-user] Custom LayoutWrappingEncoder question In-Reply-To: References: Message-ID: <88FBEBE5-547A-4A74-80F2-AE1A721F78E9@gmail.com> Worked like a charm. Thanks! On Jan 17, 2012, at 6:46 PM, Tony Trinh wrote: > There's a bug at line 98. You need to use Layout.doLayout(event) instead of event.getFormattedMessage(). I've commented here. > > On Tue, Jan 17, 2012 at 6:41 PM, Adam Gordon wrote: > Of course. Code is available here: https://github.com/icfantv/color-logback > > The outcome is that it appears that my encoder completely ignores any of the pattern stuff. This leads me to believe I'm supposed to call something in my encoder to do this - I'd assumed that it would happen automatically. > > --adam > > http://gordonizer.com > > > > On Tue, Jan 17, 2012 at 16:21, Tony Trinh wrote: > On Tue, Jan 17, 2012 at 4:32 PM, Adam Gordon wrote: > I was missing the element. Adding got rid of the error message, but my output is not being formatted. It's like its ignoring the pattern and layout. > > > Including your code and complete logback.xml would be most helpful... > What exactly is the outcome? Describe the output (or paste it here). > > --adam > > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user > > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user -------------- next part -------------- An HTML attachment was scrubbed... URL: From louisfelix at gmail.com Wed Jan 18 22:25:04 2012 From: louisfelix at gmail.com (=?ISO-8859-1?Q?Louis=2DF=E9lix?=) Date: Wed, 18 Jan 2012 16:25:04 -0500 Subject: [logback-user] SMTPAppender mail not sent (logback 1.0.0, JDK 1.5) Message-ID: Hi, I upgraded to logback 1.0.0 in a web application (tomcat 5, JDK 1.5), and the ERROR email are not sent anymore from the SMTPAppender. When I rollback my logback-core and logback-classic JARs to version 0.9.30, it's working again. I have a simple config: smtp.xxx.xx.xx xxx at xxx.xx.xx no-reply.ti at xxx.xx.xx Test 25 %date%level%thread%logger%line%message I am using logback 1.0.0 with no problem in an other project (with JDK 1.6). Is there any known compatibility problem between logback 1.0.0 and JDK 1.5? Thanks, Louis-F?lix -------------- next part -------------- An HTML attachment was scrubbed... URL: From louisfelix at gmail.com Thu Jan 19 16:51:36 2012 From: louisfelix at gmail.com (=?ISO-8859-1?Q?Louis=2DF=E9lix?=) Date: Thu, 19 Jan 2012 10:51:36 -0500 Subject: [logback-user] SMTPAppender mail not sent (logback 1.0.0, JDK 1.5) In-Reply-To: References: Message-ID: About this issue, I would like to add that when I use the "OnConsoleStatusListener" to print status messages, there is no particular error: 10:36:46,749 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.net.SMTPAppender] 10:36:46,763 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [courriel] 10:36:46,805 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [xx.yy.zzz] to INFO 10:36:46,806 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO 10:36:46,806 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [fichier] to Logger[ROOT] 10:36:46,806 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [courriel] to Logger[ROOT] 10:36:46,806 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator at 6273305c - Registering current configuration as safe fallback point 10:36:46,811 |-INFO in ch.qos.logback.classic.net.SMTPAppender[courriel] - SMTPAppender [courriel] is tracking [1] buffers Thanks, Louis-F?lix 2012/1/18 Louis-F?lix > Hi, > > I upgraded to logback 1.0.0 in a web application (tomcat 5, JDK 1.5), and > the ERROR email are not sent anymore from the SMTPAppender. > When I rollback my logback-core and logback-classic JARs to version > 0.9.30, it's working again. > > I have a simple config: > > class="ch.qos.logback.classic.net.SMTPAppender"> > smtp.xxx.xx.xx > xxx at xxx.xx.xx > no-reply.ti at xxx.xx.xx > Test > class="ch.qos.logback.core.spi.CyclicBufferTrackerImpl"> > 25 > > > %date%level%thread%logger%line%message > > > > I am using logback 1.0.0 with no problem in an other project (with JDK > 1.6). > Is there any known compatibility problem between logback 1.0.0 and JDK 1.5? > > Thanks, > Louis-F?lix > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rspears at northweststate.edu Fri Jan 20 18:07:41 2012 From: rspears at northweststate.edu (Roger Spears) Date: Fri, 20 Jan 2012 12:07:41 -0500 Subject: [logback-user] Project Can't Find logback.xml file Message-ID: <4F199F5D.70108@northweststate.edu> Hello, I'm running Netbeans 7.0.1 on a Mac Book Pro with OS Lion. I'm currently using log4j without any problems. I wanted to try out logback. Yesterday I downloaded logback and placed the 4 jar files in the proper location. I'm able to run the basic logback HelloWorld example. Here's the code for the HelloWorld example I'm working with: package helloworld; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class HelloWorld { public static void main(String[] args) { Logger logger = LoggerFactory.getLogger("helloworld"); logger.debug("Hello world."); } } Here's my customized logback.xml file: %date %n [%thread] %level %logger{35} - %n %msg The problem is...Netbeans (or java) never picks up on my customized logback.xml file. I'm starting out easy by just changing the pattern to see if I can get it to work. When I run the project, I see the following on the console: 11:56:33.569 [main] DEBUG helloworld - Hello world. That's not the pattern I specified in logback.xml. I'm assuming I just don't have it in the proper location. I have a copy of logback.xml in the following locations just to see if I had it in the wrong place: NetBeansProjects -> HelloWorld -> src -> logback.xml NetBeansProjects -> HelloWorld -> logback.xml NetBeansProjects -> HelloWorld -> nbproject -> private -> logback.xml NetBeansProjects -> HelloWorld -> build -> classes -> logback.xml System -> Libraries -> Java -> Extensions -> logback.xml I am still unable to get the pattern I'm looking for. Does anyone know why this would be happening? Thanks, Roger -- Roger -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam.n.gordon at gmail.com Fri Jan 20 18:13:46 2012 From: adam.n.gordon at gmail.com (Adam Gordon) Date: Fri, 20 Jan 2012 10:13:46 -0700 Subject: [logback-user] Project Can't Find logback.xml file In-Reply-To: <4F199F5D.70108@northweststate.edu> References: <4F199F5D.70108@northweststate.edu> Message-ID: The XML file needs to be in your class path. The first thing I would check is to see if you can load the file as a resource with ClassLoader.getResourceAsStream(String) or similar. If this is able to load the file, then it's on your class path and I'm not sure what the problem is but it's something to eliminate as an issue first. In my maven project, I have it in src/main/resources and everything is happy. On Jan 20, 2012, at 10:07 AM, Roger Spears wrote: > Hello, > > I'm running Netbeans 7.0.1 on a Mac Book Pro with OS Lion. I'm currently using log4j without any problems. I wanted to try out logback. > > Yesterday I downloaded logback and placed the 4 jar files in the proper location. I'm able to run the basic logback HelloWorld example. Here's the code for the HelloWorld example I'm working with: > > package helloworld; > > import org.slf4j.Logger; > import org.slf4j.LoggerFactory; > > public class HelloWorld { > > public static void main(String[] args) { > > Logger logger = LoggerFactory.getLogger("helloworld"); > logger.debug("Hello world."); > > } > > } > > Here's my customized logback.xml file: > > > > > %date %n [%thread] %level %logger{35} - %n %msg > > > > > > > > The problem is...Netbeans (or java) never picks up on my customized logback.xml file. I'm starting out easy by just changing the pattern to see if I can get it to work. When I run the project, I see the following on the console: > > 11:56:33.569 [main] DEBUG helloworld - Hello world. > > That's not the pattern I specified in logback.xml. > > I'm assuming I just don't have it in the proper location. I have a copy of logback.xml in the following locations just to see if I had it in the wrong place: > > NetBeansProjects -> HelloWorld -> src -> logback.xml > > NetBeansProjects -> HelloWorld -> logback.xml > > NetBeansProjects -> HelloWorld -> nbproject -> private -> logback.xml > > NetBeansProjects -> HelloWorld -> build -> classes -> logback.xml > > System -> Libraries -> Java -> Extensions -> logback.xml > > > I am still unable to get the pattern I'm looking for. > > Does anyone know why this would be happening? > > Thanks, > Roger > -- > Roger > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user -------------- next part -------------- An HTML attachment was scrubbed... URL: From rspears at northweststate.edu Fri Jan 20 18:42:59 2012 From: rspears at northweststate.edu (Roger Spears) Date: Fri, 20 Jan 2012 12:42:59 -0500 Subject: [logback-user] Project Can't Find logback.xml file In-Reply-To: References: <4F199F5D.70108@northweststate.edu> Message-ID: <4F19A7A3.8040106@northweststate.edu> Hello, Thank you for your suggestion of add the ClassLoader. I don't know why I didn't think of that. Maybe it's because I'm fairly new to Java. I added the following two lines to my HelloWorld.java class: String URL = "logback.xml"; System.out.println(ClassLoader.getSystemResource(URL)); The output I receive on the console looks like this: file:/Users/roger/NetBeansProjects/HelloWorld/build/classes/logback.xml 12:30:01.762 [main] DEBUG helloworld - Hello world. When I open the logback.xml file that is listed in the console output, it looks exactly like the custom logback.xml file I created. The problem still exists that it's not picking up on the custom pattern I have in logback.xml. That pattern looks like this: %date %n [%thread] %level %logger{35} - %n %msg I would have expected to see the date followed by a jump down to a new line followed by [main] followed by a jump down to a new line and etc. etc etc. Am I wrong to think logback uses %n as new line characters? My experience has been with log4j and %n generates the newline in its pattern. Thanks again, Rogert > Adam Gordon > January 20, 2012 12:13 PM > The XML file needs to be in your class path. The first thing I would > check is to see if you can load the file as a resource with > ClassLoader.getResourceAsStream(String) or similar. If this is able to > load the file, then it's on your class path and I'm not sure what the > problem is but it's something to eliminate as an issue first. > > In my maven project, I have it in src/main/resources and everything is > happy. > > > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user > Roger Spears > January 20, 2012 12:07 PM > Hello, > > I'm running Netbeans 7.0.1 on a Mac Book Pro with OS Lion. I'm > currently using log4j without any problems. I wanted to try out logback. > > Yesterday I downloaded logback and placed the 4 jar files in the > proper location. I'm able to run the basic logback HelloWorld > example. Here's the code for the HelloWorld example I'm working with: > > package helloworld; > > import org.slf4j.Logger; > import org.slf4j.LoggerFactory; > > public class HelloWorld { > > public static void main(String[] args) { > > Logger logger = LoggerFactory.getLogger("helloworld"); > logger.debug("Hello world."); > > } > > } > > Here's my customized logback.xml file: > > > > > %date %n [%thread] %level %logger{35} - %n %msg > > > > > > > > The problem is...Netbeans (or java) never picks up on my customized > logback.xml file. I'm starting out easy by just changing the pattern > to see if I can get it to work. When I run the project, I see the > following on the console: > > 11:56:33.569 [main] DEBUG helloworld - Hello world. > > That's not the pattern I specified in logback.xml. > > I'm assuming I just don't have it in the proper location. I have a > copy of logback.xml in the following locations just to see if I had it > in the wrong place: > > NetBeansProjects -> HelloWorld -> src -> logback.xml > > NetBeansProjects -> HelloWorld -> logback.xml > > NetBeansProjects -> HelloWorld -> nbproject -> private -> logback.xml > > NetBeansProjects -> HelloWorld -> build -> classes -> logback.xml > > System -> Libraries -> Java -> Extensions -> logback.xml > > > I am still unable to get the pattern I'm looking for. > > Does anyone know why this would be happening? > > Thanks, > Roger -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: postbox-contact.jpg Type: image/jpeg Size: 1251 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: compose-unknown-contact.jpg Type: image/jpeg Size: 770 bytes Desc: not available URL: From adam.n.gordon at gmail.com Fri Jan 20 18:58:23 2012 From: adam.n.gordon at gmail.com (Adam Gordon) Date: Fri, 20 Jan 2012 10:58:23 -0700 Subject: [logback-user] Project Can't Find logback.xml file In-Reply-To: <4F19A7A3.8040106@northweststate.edu> References: <4F199F5D.70108@northweststate.edu> <4F19A7A3.8040106@northweststate.edu> Message-ID: <3DBD193F-6A4B-49BF-B915-F717390FD573@gmail.com> I'm no logback expert either? :-) No, you're right. %n is a newline. The space character beforehand is not necessary but it shouldn't cause any issues. See http://logback.qos.ch/manual/layouts.html for details on pattern characters (what they are, how to use them, etc?) I don't know if it will make any difference - as I don't know what the default encoder is if you don't specify one, but try setting the class attribute on your element, i.e.: ?. You may also want to try changing the pattern to see if the changes are indeed picked up. I don't see any package in front of your class, but this may be due to the class being in the default package. On Jan 20, 2012, at 10:42 AM, Roger Spears wrote: > Hello, > > Thank you for your suggestion of add the ClassLoader. I don't know why I didn't think of that. Maybe it's because I'm fairly new to Java. > > I added the following two lines to my HelloWorld.java class: > > String URL = "logback.xml"; > System.out.println(ClassLoader.getSystemResource(URL)); > > The output I receive on the console looks like this: > > file:/Users/roger/NetBeansProjects/HelloWorld/build/classes/logback.xml > 12:30:01.762 [main] DEBUG helloworld - Hello world. > > When I open the logback.xml file that is listed in the console output, it looks exactly like the custom logback.xml file I created. > > The problem still exists that it's not picking up on the custom pattern I have in logback.xml. That pattern looks like this: > > %date %n [%thread] %level %logger{35} - %n %msg > > > I would have expected to see the date followed by a jump down to a new line followed by [main] followed by a jump down to a new line and etc. etc etc. > > Am I wrong to think logback uses %n as new line characters? > > My experience has been with log4j and %n generates the newline in its pattern. > > Thanks again, > Rogert > >> Adam Gordon January 20, 2012 12:13 PM >> The XML file needs to be in your class path. The first thing I would check is to see if you can load the file as a resource with ClassLoader.getResourceAsStream(String) or similar. If this is able to load the file, then it's on your class path and I'm not sure what the problem is but it's something to eliminate as an issue first. >> >> In my maven project, I have it in src/main/resources and everything is happy. >> >> >> >> _______________________________________________ >> Logback-user mailing list >> Logback-user at qos.ch >> http://mailman.qos.ch/mailman/listinfo/logback-user >> Roger Spears January 20, 2012 12:07 PM >> Hello, >> >> I'm running Netbeans 7.0.1 on a Mac Book Pro with OS Lion. I'm currently using log4j without any problems. I wanted to try out logback. >> >> Yesterday I downloaded logback and placed the 4 jar files in the proper location. I'm able to run the basic logback HelloWorld example. Here's the code for the HelloWorld example I'm working with: >> >> package helloworld; >> >> import org.slf4j.Logger; >> import org.slf4j.LoggerFactory; >> >> public class HelloWorld { >> >> public static void main(String[] args) { >> >> Logger logger = LoggerFactory.getLogger("helloworld"); >> logger.debug("Hello world."); >> >> } >> >> } >> >> Here's my customized logback.xml file: >> >> >> >> >> %date %n [%thread] %level %logger{35} - %n %msg >> >> >> >> >> >> >> >> The problem is...Netbeans (or java) never picks up on my customized logback.xml file. I'm starting out easy by just changing the pattern to see if I can get it to work. When I run the project, I see the following on the console: >> >> 11:56:33.569 [main] DEBUG helloworld - Hello world. >> >> That's not the pattern I specified in logback.xml. >> >> I'm assuming I just don't have it in the proper location. I have a copy of logback.xml in the following locations just to see if I had it in the wrong place: >> >> NetBeansProjects -> HelloWorld -> src -> logback.xml >> >> NetBeansProjects -> HelloWorld -> logback.xml >> >> NetBeansProjects -> HelloWorld -> nbproject -> private -> logback.xml >> >> NetBeansProjects -> HelloWorld -> build -> classes -> logback.xml >> >> System -> Libraries -> Java -> Extensions -> logback.xml >> >> >> I am still unable to get the pattern I'm looking for. >> >> Does anyone know why this would be happening? >> >> Thanks, >> Roger > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: postbox-contact.jpg Type: image/jpeg Size: 1251 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: compose-unknown-contact.jpg Type: image/jpeg Size: 770 bytes Desc: not available URL: From tony19 at gmail.com Fri Jan 20 19:34:04 2012 From: tony19 at gmail.com (Tony Trinh) Date: Fri, 20 Jan 2012 13:34:04 -0500 Subject: [logback-user] Project Can't Find logback.xml file In-Reply-To: <4F199F5D.70108@northweststate.edu> References: <4F199F5D.70108@northweststate.edu> Message-ID: Put logback.xml into the root of your src directory (not in a subdir). This worked fine for me (see attached Netbeans project). The output you were seeing was from the BasicConfigurator (loaded by default when logback.xml is not found in your classpath), which uses the ConsoleAppender. It just so happens that your logback.xml also uses the same type of appender, which might have confused you into thinking that Logback was ignoring the specified pattern in your configuration. On Fri, Jan 20, 2012 at 12:07 PM, Roger Spears wrote: > Hello, > > I'm running Netbeans 7.0.1 on a Mac Book Pro with OS Lion. I'm currently > using log4j without any problems. I wanted to try out logback. > > Yesterday I downloaded logback and placed the 4 jar files in the proper > location. I'm able to run the basic logback HelloWorld example. Here's > the code for the HelloWorld example I'm working with: > > package helloworld; > > import org.slf4j.Logger; > import org.slf4j.LoggerFactory; > > public class HelloWorld { > > public static void main(String[] args) { > > Logger logger = LoggerFactory.getLogger("helloworld"); > logger.debug("Hello world."); > > } > > } > > Here's my customized logback.xml file: > > > > > %date %n [%thread] %level %logger{35} - %n %msg > > > > > > > > The problem is...Netbeans (or java) never picks up on my customized > logback.xml file. I'm starting out easy by just changing the pattern to > see if I can get it to work. When I run the project, I see the following > on the console: > > 11:56:33.569 [main] DEBUG helloworld - Hello world. > > That's not the pattern I specified in logback.xml. > > I'm assuming I just don't have it in the proper location. I have a copy > of logback.xml in the following locations just to see if I had it in the > wrong place: > > NetBeansProjects -> HelloWorld -> src -> logback.xml > > NetBeansProjects -> HelloWorld -> logback.xml > > NetBeansProjects -> HelloWorld -> nbproject -> private -> logback.xml > > NetBeansProjects -> HelloWorld -> build -> classes -> logback.xml > > System -> Libraries -> Java -> Extensions -> logback.xml > > > I am still unable to get the pattern I'm looking for. > > Does anyone know why this would be happening? > > Thanks, > Roger > -- > Roger**** > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: HelloWorld.tgz Type: application/x-gzip Size: 11044 bytes Desc: not available URL: From rspears at northweststate.edu Sat Jan 21 01:41:00 2012 From: rspears at northweststate.edu (Roger Spears) Date: Fri, 20 Jan 2012 19:41:00 -0500 Subject: [logback-user] Project Can't Find logback.xml file In-Reply-To: References: <4F199F5D.70108@northweststate.edu> Message-ID: <4F1A099C.4030601@northweststate.edu> I'm curious, when you run the attached project, what do you get for the console output? Since it has FOOBAR in the pattern, I would have expected to see FOOBAR on the console. Instead, I still see the default display: 19:34:45.088 [main] INFO helloworld.HelloWorld - hello world! Is that what you get when you the project that you attached? Thanks, Roger > Tony Trinh > January 20, 2012 1:34 PM > Put logback.xml into the root of your src directory (not in a subdir). > This > worked fine for me (see attached Netbeans project). > > The output you were seeing was from the > BasicConfigurator > (loaded > by default when logback.xml is not found in your classpath), which > uses the > ConsoleAppender. It just so happens that your logback.xml also uses the > same type of appender, which might have confused you into thinking that > Logback was ignoring the specified pattern in your configuration. > > > On Fri, Jan 20, 2012 at 12:07 PM, Roger Spears > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user > Roger Spears > January 20, 2012 12:07 PM > Hello, > > I'm running Netbeans 7.0.1 on a Mac Book Pro with OS Lion. I'm > currently using log4j without any problems. I wanted to try out logback. > > Yesterday I downloaded logback and placed the 4 jar files in the > proper location. I'm able to run the basic logback HelloWorld > example. Here's the code for the HelloWorld example I'm working with: > > package helloworld; > > import org.slf4j.Logger; > import org.slf4j.LoggerFactory; > > public class HelloWorld { > > public static void main(String[] args) { > > Logger logger = LoggerFactory.getLogger("helloworld"); > logger.debug("Hello world."); > > } > > } > > Here's my customized logback.xml file: > > > > > %date %n [%thread] %level %logger{35} - %n %msg > > > > > > > > The problem is...Netbeans (or java) never picks up on my customized > logback.xml file. I'm starting out easy by just changing the pattern > to see if I can get it to work. When I run the project, I see the > following on the console: > > 11:56:33.569 [main] DEBUG helloworld - Hello world. > > That's not the pattern I specified in logback.xml. > > I'm assuming I just don't have it in the proper location. I have a > copy of logback.xml in the following locations just to see if I had it > in the wrong place: > > NetBeansProjects -> HelloWorld -> src -> logback.xml > > NetBeansProjects -> HelloWorld -> logback.xml > > NetBeansProjects -> HelloWorld -> nbproject -> private -> logback.xml > > NetBeansProjects -> HelloWorld -> build -> classes -> logback.xml > > System -> Libraries -> Java -> Extensions -> logback.xml > > > I am still unable to get the pattern I'm looking for. > > Does anyone know why this would be happening? > > Thanks, > Roger -- Roger Spears Training Coordinator Northwest State Community College 22600 State Route 34 Archbold, Ohio 43502 P: 419-267-1304 F: 419-267-3891 ********************* These records are protected by the Family Educational Rights and Privacy Act (FERPA) and are provided under an exception to the Act found in Section 99.32. These records must be maintained confidentially and may not be re disclosed. They must be destroyed when your legitimate educational interest no longer exists. If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this email transmission in error, please notify me by telephone or via return email and delete this email from your system. http://www2.ed.gov/policy/gen/reg/ferpa/index.html -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: compose-unknown-contact.jpg Type: image/jpeg Size: 770 bytes Desc: not available URL: From adam.n.gordon at gmail.com Sat Jan 21 01:44:27 2012 From: adam.n.gordon at gmail.com (Adam Gordon) Date: Fri, 20 Jan 2012 17:44:27 -0700 Subject: [logback-user] Project Can't Find logback.xml file In-Reply-To: <4F1A099C.4030601@northweststate.edu> References: <4F199F5D.70108@northweststate.edu> <4F1A099C.4030601@northweststate.edu> Message-ID: <-3829111931264972266@unknownmsgid> based on Tony's earlier response, it sounds like log back still cannot find your XML file on the class path. --adam On Jan 20, 2012, at 17:41, Roger Spears wrote: I'm curious, when you run the attached project, what do you get for the console output? Since it has FOOBAR in the pattern, I would have expected to see FOOBAR on the console. Instead, I still see the default display: 19:34:45.088 [main] INFO helloworld.HelloWorld - hello world! Is that what you get when you the project that you attached? Thanks, Roger Tony Trinh January 20, 2012 1:34 PM Put logback.xml into the root of your src directory (not in a subdir). This worked fine for me (see attached Netbeans project). The output you were seeing was from the BasicConfigurator (loaded by default when logback.xml is not found in your classpath), which uses the ConsoleAppender. It just so happens that your logback.xml also uses the same type of appender, which might have confused you into thinking that Logback was ignoring the specified pattern in your configuration. On Fri, Jan 20, 2012 at 12:07 PM, Roger Spears _______________________________________________ Logback-user mailing list Logback-user at qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user Roger Spears January 20, 2012 12:07 PM Hello, I'm running Netbeans 7.0.1 on a Mac Book Pro with OS Lion. I'm currently using log4j without any problems. I wanted to try out logback. Yesterday I downloaded logback and placed the 4 jar files in the proper location. I'm able to run the basic logback HelloWorld example. Here's the code for the HelloWorld example I'm working with: package helloworld; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class HelloWorld { public static void main(String[] args) { Logger logger = LoggerFactory.getLogger("helloworld"); logger.debug("Hello world."); } } Here's my customized logback.xml file: %date %n [%thread] %level %logger{35} - %n %msg The problem is...Netbeans (or java) never picks up on my customized logback.xml file. I'm starting out easy by just changing the pattern to see if I can get it to work. When I run the project, I see the following on the console: 11:56:33.569 [main] DEBUG helloworld - Hello world. That's not the pattern I specified in logback.xml. I'm assuming I just don't have it in the proper location. I have a copy of logback.xml in the following locations just to see if I had it in the wrong place: NetBeansProjects -> HelloWorld -> src -> logback.xml NetBeansProjects -> HelloWorld -> logback.xml NetBeansProjects -> HelloWorld -> nbproject -> private -> logback.xml NetBeansProjects -> HelloWorld -> build -> classes -> logback.xml System -> Libraries -> Java -> Extensions -> logback.xml I am still unable to get the pattern I'm looking for. Does anyone know why this would be happening? Thanks, Roger -- Roger Spears Training Coordinator Northwest State Community College 22600 State Route 34 Archbold, Ohio 43502 P: 419-267-1304 F: 419-267-3891 ********************* These records are protected by the Family Educational Rights and Privacy Act (FERPA) and are provided under an exception to the Act found in Section 99.32. These records must be maintained confidentially and may not be re disclosed. They must be destroyed when your legitimate educational interest no longer exists. If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this email transmission in error, please notify me by telephone or via return email and delete this email from your system. http://www2.ed.gov/policy/gen/reg/ferpa/index.html _______________________________________________ Logback-user mailing list Logback-user at qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user -------------- next part -------------- An HTML attachment was scrubbed... URL: From rspears at northweststate.edu Sat Jan 21 02:06:43 2012 From: rspears at northweststate.edu (Roger Spears) Date: Fri, 20 Jan 2012 20:06:43 -0500 Subject: [logback-user] Project Can't Find logback.xml file In-Reply-To: <-3829111931264972266@unknownmsgid> References: <4F199F5D.70108@northweststate.edu> <4F1A099C.4030601@northweststate.edu> <-3829111931264972266@unknownmsgid> Message-ID: <4F1A0FA3.7080002@northweststate.edu> I also tried adding the class to the encoder. That didn't work either. Something else that's weird. I imported Tony's project to my Netbeans and it stated it had reference issues. It could not find logback-core-1.0.0.jar, logback-classic-1.0.0.jar and sl4j-api-1.6.4.jar. I know I can resolve this, I'll just point them towards my versions of those jar's. BUT, for giggles, I ran the project with the unresolved reference issues and it displayed the same thing on the console: 19:57:35.609 [main] INFO helloworld.HelloWorld - hello world! I'm not sure if that's a clue to anything or if that's the expected behavior since I have those files in my classpath. Thanks, Roger > Adam Gordon > January 20, 2012 7:44 PM > based on Tony's earlier response, it sounds like log back still cannot > find > your XML file on the class path. > > --adam > > On Jan 20, 2012, at 17:41, Roger Spears > wrote: > > I'm curious, when you run the attached project, what do you get for the > console output? Since it has FOOBAR in the pattern, I would have expected > to see FOOBAR on the console. Instead, I still see the default display: > > 19:34:45.088 [main] INFO helloworld.HelloWorld - hello world! > > Is that what you get when you the project that you attached? > > Thanks, > Roger > > > Tony Trinh > January 20, 2012 1:34 PM > Put logback.xml into the root of your src directory (not in a subdir). > This > worked fine for me (see attached Netbeans project). > > The output you were seeing was from the > BasicConfigurator > > (loaded > by default when logback.xml is not found in your classpath), which > uses the > ConsoleAppender. It just so happens that your logback.xml also uses the > same type of appender, which might have confused you into thinking that > Logback was ignoring the specified pattern in your configuration. > > > On Fri, Jan 20, 2012 at 12:07 PM, Roger Spears > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user > > Roger Spears > January 20, 2012 12:07 PM > Hello, > > I'm running Netbeans 7.0.1 on a Mac Book Pro with OS Lion. I'm currently > using log4j without any problems. I wanted to try out logback. > > Yesterday I downloaded logback and placed the 4 jar files in the proper > location. I'm able to run the basic logback HelloWorld example. Here's > the code for the HelloWorld example I'm working with: > > package helloworld; > > import org.slf4j.Logger; > import org.slf4j.LoggerFactory; > > public class HelloWorld { > > public static void main(String[] args) { > > Logger logger = LoggerFactory.getLogger("helloworld"); > logger.debug("Hello world."); > > } > > } > > Here's my customized logback.xml file: > > > > > %date %n [%thread] %level %logger{35} - %n %msg > > > > > > > > The problem is...Netbeans (or java) never picks up on my customized > logback.xml file. I'm starting out easy by just changing the pattern to > see if I can get it to work. When I run the project, I see the following > on the console: > > 11:56:33.569 [main] DEBUG helloworld - Hello world. > > That's not the pattern I specified in logback.xml. > > I'm assuming I just don't have it in the proper location. I have a copy of > logback.xml in the following locations just to see if I had it in the > wrong > place: > > NetBeansProjects -> HelloWorld -> src -> logback.xml > > NetBeansProjects -> HelloWorld -> logback.xml > > NetBeansProjects -> HelloWorld -> nbproject -> private -> logback.xml > > NetBeansProjects -> HelloWorld -> build -> classes -> logback.xml > > System -> Libraries -> Java -> Extensions -> logback.xml > > > I am still unable to get the pattern I'm looking for. > > Does anyone know why this would be happening? > > Thanks, > Roger > > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user > Tony Trinh > January 20, 2012 1:34 PM > Put logback.xml into the root of your src directory (not in a subdir). > This > worked fine for me (see attached Netbeans project). > > The output you were seeing was from the > BasicConfigurator > (loaded > by default when logback.xml is not found in your classpath), which > uses the > ConsoleAppender. It just so happens that your logback.xml also uses the > same type of appender, which might have confused you into thinking that > Logback was ignoring the specified pattern in your configuration. > > > On Fri, Jan 20, 2012 at 12:07 PM, Roger Spears > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user > Roger Spears > January 20, 2012 12:07 PM > Hello, > > I'm running Netbeans 7.0.1 on a Mac Book Pro with OS Lion. I'm > currently using log4j without any problems. I wanted to try out logback. > > Yesterday I downloaded logback and placed the 4 jar files in the > proper location. I'm able to run the basic logback HelloWorld > example. Here's the code for the HelloWorld example I'm working with: > > package helloworld; > > import org.slf4j.Logger; > import org.slf4j.LoggerFactory; > > public class HelloWorld { > > public static void main(String[] args) { > > Logger logger = LoggerFactory.getLogger("helloworld"); > logger.debug("Hello world."); > > } > > } > > Here's my customized logback.xml file: > > > > > %date %n [%thread] %level %logger{35} - %n %msg > > > > > > > > The problem is...Netbeans (or java) never picks up on my customized > logback.xml file. I'm starting out easy by just changing the pattern > to see if I can get it to work. When I run the project, I see the > following on the console: > > 11:56:33.569 [main] DEBUG helloworld - Hello world. > > That's not the pattern I specified in logback.xml. > > I'm assuming I just don't have it in the proper location. I have a > copy of logback.xml in the following locations just to see if I had it > in the wrong place: > > NetBeansProjects -> HelloWorld -> src -> logback.xml > > NetBeansProjects -> HelloWorld -> logback.xml > > NetBeansProjects -> HelloWorld -> nbproject -> private -> logback.xml > > NetBeansProjects -> HelloWorld -> build -> classes -> logback.xml > > System -> Libraries -> Java -> Extensions -> logback.xml > > > I am still unable to get the pattern I'm looking for. > > Does anyone know why this would be happening? > > Thanks, > Roger -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: postbox-contact.jpg Type: image/jpeg Size: 1251 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: compose-unknown-contact.jpg Type: image/jpeg Size: 770 bytes Desc: not available URL: From tony19 at gmail.com Sat Jan 21 03:27:36 2012 From: tony19 at gmail.com (Tony Trinh) Date: Fri, 20 Jan 2012 21:27:36 -0500 Subject: [logback-user] Project Can't Find logback.xml file In-Reply-To: <4F1A0FA3.7080002@northweststate.edu> References: <4F199F5D.70108@northweststate.edu> <4F1A099C.4030601@northweststate.edu> <-3829111931264972266@unknownmsgid> <4F1A0FA3.7080002@northweststate.edu> Message-ID: See below... On Fri, Jan 20, 2012 at 8:06 PM, Roger Spears wrote: > I also tried adding the class to the encoder. That didn't work either. > > Something else that's weird. I imported Tony's project to my Netbeans and > it stated it had reference issues. It could not find > logback-core-1.0.0.jar, logback-classic-1.0.0.jar and sl4j-api-1.6.4.jar. > I know I can resolve this, I'll just point them towards my versions of > those jar's. BUT, for giggles, I ran the project with the unresolved > reference issues and it displayed the same thing on the console: > > 19:57:35.609 [main] INFO helloworld.HelloWorld - hello world! > > I just imported that project into another machine, updated the JAR references (as they're not in the same location on the other machine), and ran it. I see this: run: 2012-01-20 21:10:50,277 FOOBAR [main] INFO helloworld.HelloWorld - hello world!BUILD SUCCESSFUL (total time: 0 seconds) > I'm not sure if that's a clue to anything or if that's the expected > behavior since I have those files in my classpath. > > Try my exact steps to create that project: 1. Create a new Java project in Netbeans (or Eclipse...same steps here work). 2. Create a class named "HelloWorld", and copy this code into it: package helloworld; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class HelloWorld { private static final Logger LOG = LoggerFactory.getLogger(HelloWorld.class); public static void main(String[] args) { LOG.info("hello world!"); } } 3. Create a file named logback.xml in the src directory (do not put it under src/helloworld or any other subdirectory). Copy the following into the file: %date %n FOOBAR [%thread] %level %logger{35} - %n %msg *You can actually put logback.xml into any directory specified by the run.classpath property in ${project.dir}/nbproject/project.properties. We used src here only because it's quick and easy.* 4. Build and run the project. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jose.caballero at tecnova.es Sat Jan 21 13:58:43 2012 From: jose.caballero at tecnova.es (Pepe Caballero) Date: Sat, 21 Jan 2012 04:58:43 -0800 (PST) Subject: [logback-user] SMTPAppender mail not sent (logback 1.0.0, JDK 1.5) In-Reply-To: References: Message-ID: <33179515.post@talk.nabble.com> I migrated from 0.9.30 to 1.0.0 and works fine for me. ?Did you add activation.jar, mail.jar and smtp.jar? Louis-F?lix wrote: > > Hi, > > I upgraded to logback 1.0.0 in a web application (tomcat 5, JDK 1.5), and > the ERROR email are not sent anymore from the SMTPAppender. > When I rollback my logback-core and logback-classic JARs to version > 0.9.30, > it's working again. > > I have a simple config: > > class="ch.qos.logback.classic.net.SMTPAppender"> > smtp.xxx.xx.xx > xxx at xxx.xx.xx > no-reply.ti at xxx.xx.xx > Test > class="ch.qos.logback.core.spi.CyclicBufferTrackerImpl"> > 25 > > > %date%level%thread%logger%line%message > > > > I am using logback 1.0.0 with no problem in an other project (with JDK > 1.6). > Is there any known compatibility problem between logback 1.0.0 and JDK > 1.5? > > Thanks, > Louis-F?lix > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user > -- View this message in context: http://old.nabble.com/SMTPAppender-mail-not-sent-%28logback-1.0.0%2C-JDK-1.5%29-tp33164248p33179515.html Sent from the Logback User mailing list archive at Nabble.com. From jose.caballero at tecnova.es Sat Jan 21 14:05:38 2012 From: jose.caballero at tecnova.es (Pepe Caballero) Date: Sat, 21 Jan 2012 05:05:38 -0800 (PST) Subject: [logback-user] =?utf-8?q?_SMTPAppender+Evaluator+Discriminator=2E?= =?utf-8?q?_=C2=BFwhat_buffer_is_send=3F?= Message-ID: <33179531.post@talk.nabble.com> I am trying to send specifing error generated for some hours of day. So I decided to extends some class 1. First i implements Evaluator do decide when to send de email. It works correctly. 2. Second, i implement Discriminator interface to generate 2 buffers, One for the messaged generated on the hours that must not sended and another one for the messaged that must be sended by email. My problems is how SMTPAppender decide what buffer must be sended. Always looks to be sended the first called. ?any idea? Thanks too much -- View this message in context: http://old.nabble.com/SMTPAppender%2BEvaluator%2BDiscriminator.-%C2%BFwhat-buffer-is-send--tp33179531p33179531.html Sent from the Logback User mailing list archive at Nabble.com. From jose.caballero at tecnova.es Mon Jan 23 12:57:47 2012 From: jose.caballero at tecnova.es (Pepe Caballero) Date: Mon, 23 Jan 2012 03:57:47 -0800 (PST) Subject: [logback-user] =?utf-8?q?SMTPAppender+Evaluator+Discriminator=2E_?= =?utf-8?q?=C2=BFwhat_buffer_is_send=3F?= In-Reply-To: <33179531.post@talk.nabble.com> References: <33179531.post@talk.nabble.com> Message-ID: <33187572.post@talk.nabble.com> I solved. The buffer sended is the buffer that the descriminator define. Thanls Pepe Caballero wrote: > > I am trying to send specifing error generated for some hours of day. So I > decided to extends some class > > 1. First i implements Evaluator do decide when to send de email. It works > correctly. > 2. Second, i implement Discriminator interface to generate 2 buffers, One > for the messaged generated on the hours that must not sended and another > one for the messaged that must be sended by email. > > My problems is how SMTPAppender decide what buffer must be sended. Always > looks to be sended the first called. > > ?any idea? > > Thanks too much > -- View this message in context: http://old.nabble.com/SMTPAppender%2BEvaluator%2BDiscriminator.-%C2%BFwhat-buffer-is-send--tp33179531p33187572.html Sent from the Logback User mailing list archive at Nabble.com. From jose.caballero at tecnova.es Mon Jan 23 14:19:48 2012 From: jose.caballero at tecnova.es (Pepe Caballero) Date: Mon, 23 Jan 2012 05:19:48 -0800 (PST) Subject: [logback-user] Class not found exception for Evaluator Message-ID: <33187958.post@talk.nabble.com> I generated a smtp appender with my evaluator. in logBack.xml I have ${correo.name.direccionSMTP} ${correo.name.to} ${correo.name.from} ${correo.name.usuario} ${correo.name.clave} %d{yyyy-MM-dd HH:mm:ss}==> %m%n When I deploy in integrated Weblogic Server with Jdeveloper11 it works fine. But, when i generated ear and deploy over my Weblogic Server i get: 12:32:57,830 |-ERROR in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Could not create component [evaluator] of type [util.log.LogSMTPEvaluator] java.lang.ClassNotFoundException: util.log.LogSMTPEvaluator at java.lang.ClassNotFoundException: util.log.LogSMTPEvaluator My aplication.ear have: - model.jar - logback-access-1.0.0.jar - logback-classic-1.0.0.jar - logback-core-1.0.0.jar - anothers jar libraries - view.war logback.xml is in view.war/WEB-INF/log-back.xml and util.log.LogSMTPEvaluator in model.jar. LogBack is initialize in a servlet init in view.war Any idea? -- View this message in context: http://old.nabble.com/Class-not-found-exception-for-Evaluator-tp33187958p33187958.html Sent from the Logback User mailing list archive at Nabble.com. From rspears at northweststate.edu Mon Jan 23 15:57:37 2012 From: rspears at northweststate.edu (Roger Spears) Date: Mon, 23 Jan 2012 09:57:37 -0500 Subject: [logback-user] Project Can't Find logback.xml file In-Reply-To: References: <4F199F5D.70108@northweststate.edu> <4F1A099C.4030601@northweststate.edu> <-3829111931264972266@unknownmsgid> <4F1A0FA3.7080002@northweststate.edu> Message-ID: <4F1D7561.7090707@northweststate.edu> Thank you for the suggestion....Unfortunately, I get the same result.... 09:49:47.151 [main] INFO logtest.LogTest - hello world I followed your directions with the exception of naming the class HelloWorld. I named it LogTest. When I right clicked on Source Package and added new xml file, Netbeans created the folder on its own. I'm attaching two screen shots of my netbeans setup. The first screen shot is LogTest.java and the second is logback.xml. Thanks, Roger -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: logtest.png Type: image/png Size: 97858 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: logback.png Type: image/png Size: 78849 bytes Desc: not available URL: From louisfelix at gmail.com Mon Jan 23 16:33:44 2012 From: louisfelix at gmail.com (=?ISO-8859-1?Q?Louis=2DF=E9lix?=) Date: Mon, 23 Jan 2012 10:33:44 -0500 Subject: [logback-user] SMTPAppender mail not sent (logback 1.0.0, JDK 1.5) In-Reply-To: <33179515.post@talk.nabble.com> References: <33179515.post@talk.nabble.com> Message-ID: Thanks for the answer, but yes, mail.jar and activation.jar are included (smtp.jar was not necessary for 0.9.30, so I guess it's not necessary for 1.0.0). The behavior is quite simple: If I start tomcat with logback-core-0.9.30.jar and logback-classic-0.9.30.jar in the lib directory of my webapp, SMTPAppender sends emails correctly (on error logging events). Now, I just stop tomcat, replace the two librairies with logback-classic-1.0.0.jar and logback-core-1.0.0.jar, and I restart tomcat, SMTPAppender do not sends emails anymore... Louis-F?lix On Sat, Jan 21, 2012 at 7:58 AM, Pepe Caballero wrote: > > > I migrated from 0.9.30 to 1.0.0 and works fine for me. ?Did you add > activation.jar, mail.jar and smtp.jar? > > > Louis-F?lix wrote: > > > > Hi, > > > > I upgraded to logback 1.0.0 in a web application (tomcat 5, JDK 1.5), and > > the ERROR email are not sent anymore from the SMTPAppender. > > When I rollback my logback-core and logback-classic JARs to version > > 0.9.30, > > it's working again. > > > > I have a simple config: > > > > > class="ch.qos.logback.classic.net.SMTPAppender"> > > smtp.xxx.xx.xx > > xxx at xxx.xx.xx > > no-reply.ti at xxx.xx.xx > > Test > > > class="ch.qos.logback.core.spi.CyclicBufferTrackerImpl"> > > 25 > > > > > > %date%level%thread%logger%line%message > > > > > > > > I am using logback 1.0.0 with no problem in an other project (with JDK > > 1.6). > > Is there any known compatibility problem between logback 1.0.0 and JDK > > 1.5? > > > > Thanks, > > Louis-F?lix > > > > _______________________________________________ > > Logback-user mailing list > > Logback-user at qos.ch > > http://mailman.qos.ch/mailman/listinfo/logback-user > > > > -- > View this message in context: > http://old.nabble.com/SMTPAppender-mail-not-sent-%28logback-1.0.0%2C-JDK-1.5%29-tp33164248p33179515.html > Sent from the Logback User mailing list archive at Nabble.com. > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony19 at gmail.com Mon Jan 23 17:01:39 2012 From: tony19 at gmail.com (Tony Trinh) Date: Mon, 23 Jan 2012 11:01:39 -0500 Subject: [logback-user] Project Can't Find logback.xml file In-Reply-To: <4F1D7561.7090707@northweststate.edu> References: <4F199F5D.70108@northweststate.edu> <4F1A099C.4030601@northweststate.edu> <-3829111931264972266@unknownmsgid> <4F1A0FA3.7080002@northweststate.edu> <4F1D7561.7090707@northweststate.edu> Message-ID: You might not have noticed that your file is named "logback.xml*.xml*" (with the extra .xml extension). Try renaming that file to "logback.xml", and then run it again. On Mon, Jan 23, 2012 at 9:57 AM, Roger Spears wrote: > Thank you for the suggestion....Unfortunately, I get the same result.... > > 09:49:47.151 [main] INFO logtest.LogTest - hello world > > > I followed your directions with the exception of naming the class > HelloWorld. I named it LogTest. > > When I right clicked on Source Package and added new xml file, Netbeans > created the folder on its own. > > > I'm attaching two screen shots of my netbeans setup. > > The first screen shot is LogTest.java and the second is logback.xml. > > Thanks, > Roger > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tony19 at gmail.com Mon Jan 23 17:04:54 2012 From: tony19 at gmail.com (Tony Trinh) Date: Mon, 23 Jan 2012 11:04:54 -0500 Subject: [logback-user] Project Can't Find logback.xml file In-Reply-To: References: <4F199F5D.70108@northweststate.edu> <4F1A099C.4030601@northweststate.edu> <-3829111931264972266@unknownmsgid> <4F1A0FA3.7080002@northweststate.edu> <4F1D7561.7090707@northweststate.edu> Message-ID: Also, your logback.xml is missing a closing bracket for *. On Mon, Jan 23, 2012 at 11:01 AM, Tony Trinh wrote: > You might not have noticed that your file is named "logback.xml*.xml*" > (with the extra .xml extension). Try renaming that file to "logback.xml", > and then run it again. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rspears at northweststate.edu Mon Jan 23 17:12:21 2012 From: rspears at northweststate.edu (Roger Spears) Date: Mon, 23 Jan 2012 11:12:21 -0500 Subject: [logback-user] Project Can't Find logback.xml file In-Reply-To: References: <4F199F5D.70108@northweststate.edu> <4F1A099C.4030601@northweststate.edu> <-3829111931264972266@unknownmsgid> <4F1A0FA3.7080002@northweststate.edu> <4F1D7561.7090707@northweststate.edu> Message-ID: <4F1D86E5.9050706@northweststate.edu> Hello, Good catches! That was a little bit embarrassing to say the least. Unfortunately, I still get the standard response on my console: 11:09:20.731 [main] INFO logtest.LogTest - hello world Also, I'm including two screen shots with this email. The first is a shot of the corrected xml code. The second is a list of what's in my library for this project. Maybe there's something there/not there that I can correct?.?. > Tony Trinh > January 23, 2012 11:04 AM > Also, your logback.xml is missing a closing bracket for > *. > > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user > Tony Trinh > January 23, 2012 11:01 AM > You might not have noticed that your file is named "logback.xml*.xml*" > (with the extra .xml extension). Try renaming that file to "logback.xml", > and then run it again. > > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user > Roger Spears > January 23, 2012 9:57 AM > Thank you for the suggestion....Unfortunately, I get the same result.... > > 09:49:47.151 [main] INFO logtest.LogTest - hello world > > > I followed your directions with the exception of naming the class > HelloWorld. I named it LogTest. > > When I right clicked on Source Package and added new xml file, > Netbeans created the folder on its own. > > > I'm attaching two screen shots of my netbeans setup. > > The first screen shot is LogTest.java and the second is logback.xml. > > Thanks, > Roger > > > Tony Trinh > January 20, 2012 9:27 PM > See below... > > On Fri, Jan 20, 2012 at 8:06 PM, Roger Spearswrote: > >> I also tried adding the class to the encoder. That didn't work either. >> >> Something else that's weird. I imported Tony's project to my Netbeans and >> it stated it had reference issues. It could not find >> logback-core-1.0.0.jar, logback-classic-1.0.0.jar and sl4j-api-1.6.4.jar. >> I know I can resolve this, I'll just point them towards my versions of >> those jar's. BUT, for giggles, I ran the project with the unresolved >> reference issues and it displayed the same thing on the console: >> >> 19:57:35.609 [main] INFO helloworld.HelloWorld - hello world! >> >> > I just imported that project into another machine, updated the JAR > references (as they're not in the same location on the other machine), and > ran it. I see this: > > run: > 2012-01-20 21:10:50,277 > FOOBAR [main] INFO helloworld.HelloWorld - > hello world!BUILD SUCCESSFUL (total time: 0 seconds) > > > >> I'm not sure if that's a clue to anything or if that's the expected >> behavior since I have those files in my classpath. >> >> > Try my exact steps to create that project: > > 1. Create a new Java project in Netbeans (or Eclipse...same steps here > work). > > 2. Create a class named "HelloWorld", and copy this code into it: > > package helloworld; > > import org.slf4j.Logger; > import org.slf4j.LoggerFactory; > > public class HelloWorld { > private static final Logger LOG = LoggerFactory.getLogger(HelloWorld.class); > public static void main(String[] args) { > LOG.info("hello world!"); > } > } > > 3. Create a file named logback.xml in the src directory (do not put it > under src/helloworld or any other subdirectory). Copy the following into > the file: > > > > > %date %n FOOBAR [%thread] %level %logger{35} - %n > %msg > > > > > > > > *You can actually put logback.xml into any directory specified by the > run.classpath property in ${project.dir}/nbproject/project.properties. We > used src here only because it's quick and easy.* > > 4. Build and run the project. > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user > Roger Spears > January 20, 2012 8:06 PM > I also tried adding the class to the encoder. That didn't work either. > > Something else that's weird. I imported Tony's project to my Netbeans > and it > stated it had reference issues. It could not find logback-core-1.0.0.jar, > logback-classic-1.0.0.jar and sl4j-api-1.6.4.jar. I know I can resolve > this, > I'll just point them towards my versions of those jar's. BUT, for > giggles, I > ran the project with the unresolved reference issues and it displayed > the same > thing on the console: > > 19:57:35.609 [main] INFO helloworld.HelloWorld - hello world! > > I'm not sure if that's a clue to anything or if that's the expected > behavior > since I have those files in my classpath. > > Thanks, > Roger > > > Adam Gordon > > January 20, 2012 7:44 PM > > based on Tony's earlier response, it sounds like log back still > cannot find > > your XML file on the class path. > > > > --adam > > > > On Jan 20, 2012, at 17:41, Roger Spears > wrote: > > > > I'm curious, when you run the attached project, what do you get for the > > console output? Since it has FOOBAR in the pattern, I would have > expected > > to see FOOBAR on the console. Instead, I still see the default display: > > > > 19:34:45.088 [main] INFO helloworld.HelloWorld - hello world! > > > > Is that what you get when you the project that you attached? > > > > Thanks, > > Roger > > > > > > Tony Trinh > > January 20, 2012 1:34 PM > > Put logback.xml into the root of your src directory (not in a > subdir). This > > worked fine for me (see attached Netbeans project). > > > > The output you were seeing was from the > > BasicConfigurator > > > > > (loaded > > by default when logback.xml is not found in your classpath), which > uses the > > ConsoleAppender. It just so happens that your logback.xml also uses the > > same type of appender, which might have confused you into thinking that > > Logback was ignoring the specified pattern in your configuration. > > > > > > On Fri, Jan 20, 2012 at 12:07 PM, Roger Spears > > > > _______________________________________________ > > Logback-user mailing list > > Logback-user at qos.ch > > http://mailman.qos.ch/mailman/listinfo/logback-user > > > > Roger Spears > > January 20, 2012 12:07 PM > > Hello, > > > > I'm running Netbeans 7.0.1 on a Mac Book Pro with OS Lion. I'm currently > > using log4j without any problems. I wanted to try out logback. > > > > Yesterday I downloaded logback and placed the 4 jar files in the proper > > location. I'm able to run the basic logback HelloWorld example. Here's > > the code for the HelloWorld example I'm working with: > > > > package helloworld; > > > > import org.slf4j.Logger; > > import org.slf4j.LoggerFactory; > > > > public class HelloWorld { > > > > public static void main(String[] args) { > > > > Logger logger = LoggerFactory.getLogger("helloworld"); > > logger.debug("Hello world."); > > > > } > > > > } > > > > Here's my customized logback.xml file: > > > > > > > > > > %date %n [%thread] %level %logger{35} - %n %msg > > > > > > > > > > > > > > > > The problem is...Netbeans (or java) never picks up on my customized > > logback.xml file. I'm starting out easy by just changing the pattern to > > see if I can get it to work. When I run the project, I see the following > > on the console: > > > > 11:56:33.569 [main] DEBUG helloworld - Hello world. > > > > That's not the pattern I specified in logback.xml. > > > > I'm assuming I just don't have it in the proper location. I have a > copy of > > logback.xml in the following locations just to see if I had it in > the wrong > > place: > > > > NetBeansProjects -> HelloWorld -> src -> logback.xml > > > > NetBeansProjects -> HelloWorld -> logback.xml > > > > NetBeansProjects -> HelloWorld -> nbproject -> private -> logback.xml > > > > NetBeansProjects -> HelloWorld -> build -> classes -> logback.xml > > > > System -> Libraries -> Java -> Extensions -> logback.xml > > > > > > I am still unable to get the pattern I'm looking for. > > > > Does anyone know why this would be happening? > > > > Thanks, > > Roger > > > > > > _______________________________________________ > > Logback-user mailing list > > Logback-user at qos.ch > > http://mailman.qos.ch/mailman/listinfo/logback-user > > Tony Trinh > > January 20, 2012 1:34 PM > > Put logback.xml into the root of your src directory (not in a > subdir). This > > worked fine for me (see attached Netbeans project). > > > > The output you were seeing was from the > > > BasicConfigurator > > (loaded > > by default when logback.xml is not found in your classpath), which > uses the > > ConsoleAppender. It just so happens that your logback.xml also uses the > > same type of appender, which might have confused you into thinking that > > Logback was ignoring the specified pattern in your configuration. > > > > > > On Fri, Jan 20, 2012 at 12:07 PM, Roger Spears > > > > _______________________________________________ > > Logback-user mailing list > > Logback-user at qos.ch > > http://mailman.qos.ch/mailman/listinfo/logback-user > > Roger Spears > > January 20, 2012 12:07 PM > > Hello, > > > > I'm running Netbeans 7.0.1 on a Mac Book Pro with OS Lion. I'm > currently > > using log4j without any problems. I wanted to try out logback. > > > > Yesterday I downloaded logback and placed the 4 jar files in the proper > > location. I'm able to run the basic logback HelloWorld example. > Here's the > > code for the HelloWorld example I'm working with: > > > > package helloworld; > > > > import org.slf4j.Logger; > > import org.slf4j.LoggerFactory; > > > > public class HelloWorld { > > > > public static void main(String[] args) { > > > > Logger logger = LoggerFactory.getLogger("helloworld"); > > logger.debug("Hello world."); > > > > } > > > > } > > > > Here's my customized logback.xml file: > > > > > > > > > > %date %n [%thread] %level %logger{35} - %n %msg > > > > > > > > > > > > > > > > The problem is...Netbeans (or java) never picks up on my customized > > logback.xml file. I'm starting out easy by just changing the pattern > to see > > if I can get it to work. When I run the project, I see the following > on the > > console: > > > > 11:56:33.569 [main] DEBUG helloworld - Hello world. > > > > That's not the pattern I specified in logback.xml. > > > > I'm assuming I just don't have it in the proper location. I have a > copy of > > logback.xml in the following locations just to see if I had it in > the wrong > > place: > > > > NetBeansProjects -> HelloWorld -> src -> logback.xml > > > > NetBeansProjects -> HelloWorld -> logback.xml > > > > NetBeansProjects -> HelloWorld -> nbproject -> private -> logback.xml > > > > NetBeansProjects -> HelloWorld -> build -> classes -> logback.xml > > > > System -> Libraries -> Java -> Extensions -> logback.xml > > > > > > I am still unable to get the pattern I'm looking for. > > > > Does anyone know why this would be happening? > > > > Thanks, > > Roger -- Roger Spears Training Coordinator Northwest State Community College 22600 State Route 34 Archbold, Ohio 43502 P: 419-267-1304 F: 419-267-3891 ********************* These records are protected by the Family Educational Rights and Privacy Act (FERPA) and are provided under an exception to the Act found in Section 99.32. These records must be maintained confidentially and may not be re disclosed. They must be destroyed when your legitimate educational interest no longer exists. If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution or use of the contents of this information is prohibited. If you have received this email transmission in error, please notify me by telephone or via return email and delete this email from your system. http://www2.ed.gov/policy/gen/reg/ferpa/index.html -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: compose-unknown-contact.jpg Type: image/jpeg Size: 770 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: CorrectedCode.png Type: image/png Size: 76123 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: LogBackLibrary.png Type: image/png Size: 59469 bytes Desc: not available URL: From curtis.porter at gmail.com Mon Jan 23 23:33:40 2012 From: curtis.porter at gmail.com (Curtis Porter) Date: Mon, 23 Jan 2012 15:33:40 -0700 Subject: [logback-user] TimeBasedFileNamingAndTriggeringPolicy writes to many files after restart Message-ID: While doing some testing I've encountered a situation where we generate a large number of log files. They seem to be rotating as expected, except for directly after a restart of the application. When that happens, logback writes a few messages to each file, starting at index 101 until it reaches the current file, at which point it resumes working normally. For example, the logs should rotate each month, and grow up to 10MB before rotating. As each rotates its log index will increase (2012-01.1.log, 2012-01.2.log, ..., 2012-01.891.log). logback is writing the first few messages to 2012-01.101.log and then walks up each log after that, writing a few log messages before moving on (presumably "realizing" that each log is at its size threshold). I'm puzzled that it starts at 2012-01.101.log (2012-01.1.log would make more sense). It's even more puzzling that it writes anything to the lower logs in the first place. Any ideas why this is happening? Here is my configuration: ALWAYS ACCEPT true %d %p [%t] %X{user} %X{session} %F:%L - %m%n ${catalina.home}/logs/tomcat.%d{yyyy-MM}.%i.log 10MB 2 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jose.caballero at tecnova.es Thu Jan 26 11:46:14 2012 From: jose.caballero at tecnova.es (Pepe Caballero) Date: Thu, 26 Jan 2012 02:46:14 -0800 (PST) Subject: [logback-user] Class not found exception for Evaluator In-Reply-To: <33187958.post@talk.nabble.com> References: <33187958.post@talk.nabble.com> Message-ID: <33206642.post@talk.nabble.com> Exception is: at java.lang.ClassNotFoundException: util.log.LogSMTPEvaluator at at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at at ch.qos.logback.core.util.Loader.loadClass(Loader.java:123) at at ch.qos.logback.core.joran.action.NestedComplexPropertyIA.begin(NestedComplexPropertyIA.java:100) at at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Interpreter.java:276) at at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:148) at at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:131) at at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:52) at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:147) at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:135) at at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:97) ?any idea? Pepe Caballero wrote: > > I generated a smtp appender with my evaluator. > in logBack.xml I have > > class="ch.qos.logback.classic.net.SMTPAppender"> > > ${correo.name.direccionSMTP} > ${correo.name.to} > ${correo.name.from} > ${correo.name.usuario} > ${correo.name.clave} > > %d{yyyy-MM-dd HH:mm:ss}==> %m%n > > > > When I deploy in integrated Weblogic Server with Jdeveloper11 it works > fine. But, when i generated ear and deploy over my Weblogic Server i get: > 12:32:57,830 |-ERROR in > ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Could not > create component [evaluator] of type [util.log.LogSMTPEvaluator] > java.lang.ClassNotFoundException: util.log.LogSMTPEvaluator > at java.lang.ClassNotFoundException: util.log.LogSMTPEvaluator > > My aplication.ear have: > - model.jar > - logback-access-1.0.0.jar > - logback-classic-1.0.0.jar > - logback-core-1.0.0.jar > - anothers jar libraries > - view.war > > logback.xml is in view.war/WEB-INF/log-back.xml and > util.log.LogSMTPEvaluator in model.jar. > LogBack is initialize in a servlet init in view.war > > Any idea? > -- View this message in context: http://old.nabble.com/Class-not-found-exception-for-Evaluator-tp33187958p33206642.html Sent from the Logback User mailing list archive at Nabble.com. From james at annesley.net Thu Jan 26 23:19:03 2012 From: james at annesley.net (James Annesley) Date: Thu, 26 Jan 2012 22:19:03 +0000 Subject: [logback-user] Tomcat log problem Message-ID: Hi I am using logback 1.0 with a tomcat web app. I can get the logger writing to console nicely. I cannot get my web app specific logback.xml to be read however. I had log4j working OK on this system previously. Using Logback-access it works but is this the only way? Can anyone help? James -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam.n.gordon at gmail.com Thu Jan 26 23:21:14 2012 From: adam.n.gordon at gmail.com (Adam Gordon) Date: Thu, 26 Jan 2012 15:21:14 -0700 Subject: [logback-user] Tomcat log problem In-Reply-To: References: Message-ID: Is the file located in your /WEB-INF/classes directory? If so, it should be getting picked up automatically. Mine is. --adam http://gordonizer.com On Thu, Jan 26, 2012 at 15:19, James Annesley wrote: > Hi > > I am using logback 1.0 with a tomcat web app. I can get the logger writing > to console nicely. I cannot get my web app specific logback.xml to be read > however. I had log4j working OK on this system previously. Using > Logback-access it works but is this the only way? Can anyone help? > > James > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From samyem at gmail.com Sun Jan 29 17:36:45 2012 From: samyem at gmail.com (samyem) Date: Sun, 29 Jan 2012 08:36:45 -0800 (PST) Subject: [logback-user] SMTPAppender mail not sent (logback 1.0.0, JDK 1.5) In-Reply-To: References: Message-ID: <33224758.post@talk.nabble.com> I am facing the exact same issue. The upgrade stopped sending emails for me as well. For some reason, the Runnable class SMTPAppender's "run" method never gets executed in this new version. Anyone else having this issue? Thanks, Louis-F?lix wrote: > > Hi, > > I upgraded to logback 1.0.0 in a web application (tomcat 5, JDK 1.5), and > the ERROR email are not sent anymore from the SMTPAppender. > When I rollback my logback-core and logback-classic JARs to version > 0.9.30, > it's working again. > > I have a simple config: > > class="ch.qos.logback.classic.net.SMTPAppender"> > smtp.xxx.xx.xx > xxx at xxx.xx.xx > no-reply.ti at xxx.xx.xx > Test > class="ch.qos.logback.core.spi.CyclicBufferTrackerImpl"> > 25 > > > %date%level%thread%logger%line%message > > > > I am using logback 1.0.0 with no problem in an other project (with JDK > 1.6). > Is there any known compatibility problem between logback 1.0.0 and JDK > 1.5? > > Thanks, > Louis-F?lix > > _______________________________________________ > Logback-user mailing list > Logback-user at qos.ch > http://mailman.qos.ch/mailman/listinfo/logback-user > -- View this message in context: http://old.nabble.com/SMTPAppender-mail-not-sent-%28logback-1.0.0%2C-JDK-1.5%29-tp33164248p33224758.html Sent from the Logback User mailing list archive at Nabble.com. From ceki at qos.ch Sun Jan 29 18:48:55 2012 From: ceki at qos.ch (ceki) Date: Sun, 29 Jan 2012 18:48:55 +0100 Subject: [logback-user] SMTPAppender mail not sent (logback 1.0.0, JDK 1.5) In-Reply-To: <33224758.post@talk.nabble.com> References: <33224758.post@talk.nabble.com> Message-ID: <4F258687.9000106@qos.ch> Hi, I intend to look into this tomorrow morning. -- Ceki http://twitter.com/#!/ceki On 29.01.2012 17:36, samyem wrote: > > > I am facing the exact same issue. The upgrade stopped sending emails for me > as well. For some reason, the Runnable class SMTPAppender's "run" method > never gets executed in this new version. Anyone else having this issue? > > Thanks, > > > Louis-F?lix wrote: >> >> Hi, >> >> I upgraded to logback 1.0.0 in a web application (tomcat 5, JDK 1.5), and >> the ERROR email are not sent anymore from the SMTPAppender. >> When I rollback my logback-core and logback-classic JARs to version >> 0.9.30, >> it's working again. >> >> I have a simple config: >> >> > class="ch.qos.logback.classic.net.SMTPAppender"> >> smtp.xxx.xx.xx >> xxx at xxx.xx.xx >> no-reply.ti at xxx.xx.xx >> Test >> > class="ch.qos.logback.core.spi.CyclicBufferTrackerImpl"> >> 25 >> >> >> %date%level%thread%logger%line%message >> >> >> >> I am using logback 1.0.0 with no problem in an other project (with JDK >> 1.6). >> Is there any known compatibility problem between logback 1.0.0 and JDK >> 1.5? >> >> Thanks, >> Louis-F?lix >> From cowwoc at bbs.darktech.org Mon Jan 30 22:44:20 2012 From: cowwoc at bbs.darktech.org (cowwoc) Date: Mon, 30 Jan 2012 13:44:20 -0800 (PST) Subject: [logback-user] Questions about SLF4JBridgeHandler Message-ID: <33221503.post@talk.nabble.com> Hi, I've got three questions: 1. http://www.slf4j.org/legacy.html mentions LevelChangePropagator but http://www.slf4j.org/api/org/slf4j/bridge/SLF4JBridgeHandler.html does not. Is it possible to add this to the Javadoc? 2. Why doesn't SLF4JBridgeHandler.install() register the listener automatically? 3. I've noticed that invoking SLF4JBridgeHandler.install() is not enough. You must remove any existing JUL handlers using: java.util.logging.Logger rootLogger = java.util.logging.LogManager.getLogManager().getLogger(""); java.util.logging.Handler[] handlers = rootLogger.getHandlers(); for (int i = 0; i < handlers.length; i++) { rootLogger.removeHandler(handlers[i]); } before invoking SLF4JBridgeHandler.install(). Shouldn't SLF4JBridgeHandler offer a method for doing it on behalf of the user? Thanks, Gili -- View this message in context: http://old.nabble.com/Questions-about-SLF4JBridgeHandler-tp33221503p33221503.html Sent from the Logback User mailing list archive at Nabble.com. From thunderaxiom at hotmail.com Tue Jan 31 13:35:11 2012 From: thunderaxiom at hotmail.com (=?UTF-8?Q?Thorbj=C3=B8rn_Ravn_Andersen?=) Date: Tue, 31 Jan 2012 13:35:11 +0100 Subject: [logback-user] SMTPAppender mail not sent (logback 1.0.0, JDK 1.5) In-Reply-To: <4F258687.9000106@qos.ch> References: <33224758.post@talk.nabble.com> <4F258687.9000106@qos.ch> Message-ID: Hi. Just ran into this bug as well (Java 1.5, logback 1.0.0, Windows 7). It appears that the code in SMTPAppenderBase if (eventEvaluator.evaluate(eventObject)) { // perform actual sending asynchronously SenderRunnable senderRunnable = new SenderRunnable(new CyclicBuffer(cb), eventObject); context.getExecutorService().execute(senderRunnable); } is properly executed, but as noted the SenderRunable.run() method is not invoked (which I have determined by having a break point). The ThreadPoolExecutor.execute() method (under Oracle Java 1.5) executes: public void execute(Runnable command) { if (command == null) throw new NullPointerException(); for (;;) { if (runState != RUNNING) { reject(command); return; } if (poolSize < corePoolSize && addIfUnderCorePoolSize(command)) return; if (workQueue.offer(command)) return; and returns (and the SenderRunnable was added to workQueue). There is, however, a potential problem of mails being lost. In the code causing me to investigate this, the "log.error("....", e)" is immediately followed by a System.exit(). In other words - I will most likely loose most of the mails generated by this code as the async process is slower than the System.exit(). Is there any way of guaranteeing that all mail has been transported before stopping the program? If not, can I have a flag simply saying "do not run async, run in process" which invokes senderRunnable.run() directly instead of delegating to an executor? (also a way of telling the operator that mail has been sent would be nice. It can be as simple as a print statement, similar to @Override protected void sendBuffer( ch.qos.logback.core.helpers.CyclicBuffer cb, ILoggingEvent lastEventObject) { System.out.println("[" + new java.util.Date() + " " + this.getClass().getSimpleName() + " sending e-mail notification with " + cb.length() + " events]"); super.sendBuffer(cb, lastEventObject); }; ) Thanks /Thorbj?rn -----Original Message----- From: logback-user-bounces at qos.ch [mailto:logback-user-bounces at qos.ch] On Behalf Of ceki Sent: 29. januar 2012 18:49 To: logback users list Subject: Re: [logback-user] SMTPAppender mail not sent (logback 1.0.0, JDK 1.5) Hi, I intend to look into this tomorrow morning. -- Ceki http://twitter.com/#!/ceki On 29.01.2012 17:36, samyem wrote: > > > I am facing the exact same issue. The upgrade stopped sending emails > for me as well. For some reason, the Runnable class SMTPAppender's > "run" method never gets executed in this new version. Anyone else having this issue? > > Thanks, > > > Louis-F?lix wrote: >> >> Hi, >> >> I upgraded to logback 1.0.0 in a web application (tomcat 5, JDK 1.5), >> and the ERROR email are not sent anymore from the SMTPAppender. >> When I rollback my logback-core and logback-classic JARs to version >> 0.9.30, it's working again. >> >> I have a simple config: >> >> > class="ch.qos.logback.classic.net.SMTPAppender"> >> smtp.xxx.xx.xx >> xxx at xxx.xx.xx >> no-reply.ti at xxx.xx.xx >> Test >> > class="ch.qos.logback.core.spi.CyclicBufferTrackerImpl"> >> 25 >> >> >> %date%level%thread%logger%line%message >> >> >> >> I am using logback 1.0.0 with no problem in an other project (with >> JDK 1.6). >> Is there any known compatibility problem between logback 1.0.0 and >> JDK 1.5? >> >> Thanks, >> Louis-F?lix >> _______________________________________________ Logback-user mailing list Logback-user at qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user From grave1740 at googlemail.com Tue Jan 31 16:39:11 2012 From: grave1740 at googlemail.com (Henning Diederichs) Date: Tue, 31 Jan 2012 16:39:11 +0100 Subject: [logback-user] DBAppender and EJB managed transactions Message-ID: Hi there, I think I found out, why I couldn't log in database as I described in December. I activated the status listener as mentioned in an earlier question concerning DBAppender like this: and got this exception from JBoss: ERROR in ch.qos.logback.classic.db.DBAppender[myDBAppender] - problem appending event java.sql.SQLException: You cannot set autocommit during a managed transaction! at java.sql.SQLException: You cannot set autocommit during a managed transaction! at at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.setJdbcAutoCommit(BaseWrapperManagedConnection.java:878) at at org.jboss.jca.adapters.jdbc.WrappedConnection.setAutoCommit(WrappedConnection.java:712) at at ch.qos.logback.core.db.DBAppenderBase.append(DBAppenderBase.java:90) at at ch.qos.logback.core.UnsynchronizedAppenderBase.doAppend(UnsynchronizedAppenderBase.java:88) at at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:64) at at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:285) at at ch.qos.logback.classic.Logger.callAppenders(Logger.java:272) at at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:473) at at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:427) at at ch.qos.logback.classic.Logger.error(Logger.java:574) The transaction is handled by the EJB container and cannot be managed by DBAppenderBase line 90. I also tested the DBAppender in a web project that only uses Servlets and no EJBs. I could manage to log with the same log file. Is this a known issue? There has to be a possibility to log to DB without managing the transaction. Best if logback itself finds out, if managing transactions manually is allowed or not. Regards, Henning