SMTPAppender mail not sent (logback 1.0.0, JDK 1.5)

View: New views
11 Messages — Rating Filter:   Alert me  

SMTPAppender mail not sent (logback 1.0.0, JDK 1.5)

by Louis-Félix :: Rate this Message:

| View Threaded | Show Only this Message

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:

    <appender name="courriel" class="ch.qos.logback.classic.net.SMTPAppender">
        <smtpHost>smtp.xxx.xx.xx</smtpHost>
        <to>xxx@...</to>
        <from>no-reply.ti@...</from>
        <subject>Test</subject>
        <cyclicBufferTracker class="ch.qos.logback.core.spi.CyclicBufferTrackerImpl">
            <bufferSize>25</bufferSize>
        </cyclicBufferTracker>
        <layout class="ch.qos.logback.classic.html.HTMLLayout">
            <pattern>%date%level%thread%logger%line%message</pattern>
        </layout>
    </appender>

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@...
http://mailman.qos.ch/mailman/listinfo/logback-user

Re: SMTPAppender mail not sent (logback 1.0.0, JDK 1.5)

by Louis-Félix :: Rate this Message:

| View Threaded | Show Only this Message

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@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 <louisfelix@...>
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:

    <appender name="courriel" class="ch.qos.logback.classic.net.SMTPAppender">
        <smtpHost>smtp.xxx.xx.xx</smtpHost>
        <to>xxx@...</to>
        <from>no-reply.ti@...</from>
        <subject>Test</subject>
        <cyclicBufferTracker class="ch.qos.logback.core.spi.CyclicBufferTrackerImpl">
            <bufferSize>25</bufferSize>
        </cyclicBufferTracker>
        <layout class="ch.qos.logback.classic.html.HTMLLayout">
            <pattern>%date%level%thread%logger%line%message</pattern>
        </layout>
    </appender>

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@...
http://mailman.qos.ch/mailman/listinfo/logback-user

Re: SMTPAppender mail not sent (logback 1.0.0, JDK 1.5)

by Pepe Caballero :: Rate this Message:

| View Threaded | Show Only this Message


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:

    <appender name="courriel"
class="ch.qos.logback.classic.net.SMTPAppender">
        <smtpHost>smtp.xxx.xx.xx</smtpHost>
        <to>xxx@xxx.xx.xx</to>
        <from>no-reply.ti@xxx.xx.xx</from>
        <subject>Test</subject>
        <cyclicBufferTracker
class="ch.qos.logback.core.spi.CyclicBufferTrackerImpl">
            <bufferSize>25</bufferSize>
        </cyclicBufferTracker>
        <layout class="ch.qos.logback.classic.html.HTMLLayout">
            <pattern>%date%level%thread%logger%line%message</pattern>
        </layout>
    </appender>

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@qos.ch
http://mailman.qos.ch/mailman/listinfo/logback-user

Re: SMTPAppender mail not sent (logback 1.0.0, JDK 1.5)

by Louis-Félix :: Rate this Message:

| View Threaded | Show Only this Message

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 <jose.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:
>
>     <appender name="courriel"
> class="ch.qos.logback.classic.net.SMTPAppender">
>         <smtpHost>smtp.xxx.xx.xx</smtpHost>
>         <to>xxx@...</to>
>         <from>no-reply.ti@...</from>
>         <subject>Test</subject>
>         <cyclicBufferTracker
> class="ch.qos.logback.core.spi.CyclicBufferTrackerImpl">
>             <bufferSize>25</bufferSize>
>         </cyclicBufferTracker>
>         <layout class="ch.qos.logback.classic.html.HTMLLayout">
>             <pattern>%date%level%thread%logger%line%message</pattern>
>         </layout>
>     </appender>
>
> 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@...
> 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@...
http://mailman.qos.ch/mailman/listinfo/logback-user


_______________________________________________
Logback-user mailing list
Logback-user@...
http://mailman.qos.ch/mailman/listinfo/logback-user

Re: SMTPAppender mail not sent (logback 1.0.0, JDK 1.5)

by samyem :: Rate this Message:

| View Threaded | Show Only this Message


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:

    <appender name="courriel"
class="ch.qos.logback.classic.net.SMTPAppender">
        <smtpHost>smtp.xxx.xx.xx</smtpHost>
        <to>xxx@xxx.xx.xx</to>
        <from>no-reply.ti@xxx.xx.xx</from>
        <subject>Test</subject>
        <cyclicBufferTracker
class="ch.qos.logback.core.spi.CyclicBufferTrackerImpl">
            <bufferSize>25</bufferSize>
        </cyclicBufferTracker>
        <layout class="ch.qos.logback.classic.html.HTMLLayout">
            <pattern>%date%level%thread%logger%line%message</pattern>
        </layout>
    </appender>

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@qos.ch
http://mailman.qos.ch/mailman/listinfo/logback-user

Re: SMTPAppender mail not sent (logback 1.0.0, JDK 1.5)

by Ceki Gulcu :: Rate this Message:

| View Threaded | Show Only this Message

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:
>>
>>      <appender name="courriel"
>> class="ch.qos.logback.classic.net.SMTPAppender">
>>          <smtpHost>smtp.xxx.xx.xx</smtpHost>
>>          <to>xxx@...</to>
>>          <from>no-reply.ti@...</from>
>>          <subject>Test</subject>
>>          <cyclicBufferTracker
>> class="ch.qos.logback.core.spi.CyclicBufferTrackerImpl">
>>              <bufferSize>25</bufferSize>
>>          </cyclicBufferTracker>
>>          <layout class="ch.qos.logback.classic.html.HTMLLayout">
>>              <pattern>%date%level%thread%logger%line%message</pattern>
>>          </layout>
>>      </appender>
>>
>> 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@...
http://mailman.qos.ch/mailman/listinfo/logback-user

Re: SMTPAppender mail not sent (logback 1.0.0, JDK 1.5)

by Thorbjørn Ravn Andersen-4 :: Rate this Message:

| View Threaded | Show Only this Message

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<E>(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<ILoggingEvent> 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@... [mailto:logback-user-bounces@...] 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:
>>
>>      <appender name="courriel"
>> class="ch.qos.logback.classic.net.SMTPAppender">
>>          <smtpHost>smtp.xxx.xx.xx</smtpHost>
>>          <to>xxx@...</to>
>>          <from>no-reply.ti@...</from>
>>          <subject>Test</subject>
>>          <cyclicBufferTracker
>> class="ch.qos.logback.core.spi.CyclicBufferTrackerImpl">
>>              <bufferSize>25</bufferSize>
>>          </cyclicBufferTracker>
>>          <layout class="ch.qos.logback.classic.html.HTMLLayout">
>>              <pattern>%date%level%thread%logger%line%message</pattern>
>>          </layout>
>>      </appender>
>>
>> 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@...
http://mailman.qos.ch/mailman/listinfo/logback-user

_______________________________________________
Logback-user mailing list
Logback-user@...
http://mailman.qos.ch/mailman/listinfo/logback-user

Re: SMTPAppender mail not sent (logback 1.0.0, JDK 1.5)

by Ceki Gulcu :: Rate this Message:

| View Threaded | Show Only this Message

Hi Endre,

I was not able to make headway regarding this issue. Several people
suffer from it as attested by LBCLASSIC-323.

Regarding the early exit problem, the following code

import ch.qos.logback.core.Context;
import ch.qos.logback.core.ContextBase;

public class Main {

   public static void main(String[] args) {
     Context context = new ContextBase();
     for(int i = 0; i < 3; i++) {
       SenderRunnable senderRunnable = new SenderRunnable(""+i);
       context.getExecutorService().execute(senderRunnable);
     }
     System.out.println("done");
     System.exit(0);
   }

   static class SenderRunnable implements Runnable {
     String id;
     SenderRunnable(String id) {
       this.id = id;
     }

     public void run() {
       System.out.println("SenderRunnable " +id);
     }
   }
}

yields

done
SenderRunnable 0
SenderRunnable 1
SenderRunnable 2

I am continuing to investigate.

--
Ceki
http://twitter.com/#!/ceki


On 31.01.2012 13:35, Thorbjørn Ravn Andersen wrote:

> 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<E>(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<ILoggingEvent>  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@... [mailto:logback-user-bounces@...] 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:
>>>
>>>       <appender name="courriel"
>>> class="ch.qos.logback.classic.net.SMTPAppender">
>>>           <smtpHost>smtp.xxx.xx.xx</smtpHost>
>>>           <to>xxx@...</to>
>>>           <from>no-reply.ti@...</from>
>>>           <subject>Test</subject>
>>>           <cyclicBufferTracker
>>> class="ch.qos.logback.core.spi.CyclicBufferTrackerImpl">
>>>               <bufferSize>25</bufferSize>
>>>           </cyclicBufferTracker>
>>>           <layout class="ch.qos.logback.classic.html.HTMLLayout">
>>>               <pattern>%date%level%thread%logger%line%message</pattern>
>>>           </layout>
>>>       </appender>
>>>
>>> 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@...
http://mailman.qos.ch/mailman/listinfo/logback-user

Re: SMTPAppender mail not sent (logback 1.0.0, JDK 1.5)

by Thorbjørn Ravn Andersen-4 :: Rate this Message:

| View Threaded | Show Only this Message

Regarding the early exit code, I believe your runnables are too shortlived to prove anything here.

Try putting a 1-2 second delay in before the print statement to more accurately reflect that sending takes time.

I still would like just a "send synchroneous, please" option.  Having the email sent is more important to us than an occasional slow log statement.

/Thorbjørn

-----Original Message-----
From: logback-user-bounces@... [mailto:logback-user-bounces@...] On Behalf Of ceki
Sent: 5. marts 2012 18:55
To: logback users list
Subject: Re: [logback-user] SMTPAppender mail not sent (logback 1.0.0, JDK 1.5)

Hi Endre,

I was not able to make headway regarding this issue. Several people suffer from it as attested by LBCLASSIC-323.

Regarding the early exit problem, the following code

import ch.qos.logback.core.Context;
import ch.qos.logback.core.ContextBase;

public class Main {

   public static void main(String[] args) {
     Context context = new ContextBase();
     for(int i = 0; i < 3; i++) {
       SenderRunnable senderRunnable = new SenderRunnable(""+i);
       context.getExecutorService().execute(senderRunnable);
     }
     System.out.println("done");
     System.exit(0);
   }

   static class SenderRunnable implements Runnable {
     String id;
     SenderRunnable(String id) {
       this.id = id;
     }

     public void run() {
       System.out.println("SenderRunnable " +id);
     }
   }
}

yields

done
SenderRunnable 0
SenderRunnable 1
SenderRunnable 2

I am continuing to investigate.

--
Ceki
http://twitter.com/#!/ceki


On 31.01.2012 13:35, Thorbjørn Ravn Andersen wrote:

> 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<E>(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<ILoggingEvent>  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@... [mailto:logback-user-bounces@...] 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:
>>>
>>>       <appender name="courriel"
>>> class="ch.qos.logback.classic.net.SMTPAppender">
>>>           <smtpHost>smtp.xxx.xx.xx</smtpHost>
>>>           <to>xxx@...</to>
>>>           <from>no-reply.ti@...</from>
>>>           <subject>Test</subject>
>>>           <cyclicBufferTracker
>>> class="ch.qos.logback.core.spi.CyclicBufferTrackerImpl">
>>>               <bufferSize>25</bufferSize>
>>>           </cyclicBufferTracker>
>>>           <layout class="ch.qos.logback.classic.html.HTMLLayout">
>>>               <pattern>%date%level%thread%logger%line%message</pattern>
>>>           </layout>
>>>       </appender>
>>>
>>> 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@...
http://mailman.qos.ch/mailman/listinfo/logback-user

_______________________________________________
Logback-user mailing list
Logback-user@...
http://mailman.qos.ch/mailman/listinfo/logback-user

Re: SMTPAppender mail not sent (logback 1.0.0, JDK 1.5)

by Dave-484 :: Rate this Message:

| View Threaded | Show Only this Message

Hi everyone.  First time poster.  I thought I'd share my experiences and
findings on the SMTPAppender issues.

I've been struggling to get the STMPAppender working consistently ever since
version 0.9.29.  I've noticed on this mailing list that it might have been
related to JDK 1.5. So I've upgraded our environment to JDK 1.6 (along with
upgrading logback to 1.0.1) and every seemed to be working fine.

Then a few days ago, I didn't receive an e-mail from a STMPAppender event that I
knew for sure I was supposed to get.  I isolated and reproduced the event 10
consecutive times, with about 2 seconds between events.  When I checked my email
log, I only received 9 messages.

I ran the test again, and got all 10 messages as expected.  Tried again once
more, and again got 10 messages.  I decided to run my test one more time before
I put it to rest, but this time I got 9 messages.

After browsing the mailing lists for this issue, I saw Ceki's sample code
(posted March 5) testing the ExecutorService.  I clipped it out and tried it on
my machine (running jdk1.6.0_31).  I've found that this too was giving
inconsistent results.  Out of the three processes it suppose to execute, I get
results of 3,3,1,0,0,3,3,1,3 .... I was surprised to see it not execute any
processes at times. When running on JDK 1.5, I'm unable to get any results.

Anyways, that's my 0.02 cents that I can offer on this.  If there's any other
help I can offer pleas let me know

-dave
_______________________________________________
Logback-user mailing list
Logback-user@...
http://mailman.qos.ch/mailman/listinfo/logback-user

Re: SMTPAppender mail not sent (logback 1.0.0, JDK 1.5)

by Ceki Gulcu :: Rate this Message:

| View Threaded | Show Only this Message

On 19.04.2012 00:02, Dave wrote:

> Hi everyone. First time poster. I thought I'd share my experiences and
> findings on the SMTPAppender issues.
>
> I've been struggling to get the STMPAppender working consistently ever
> since version 0.9.29. I've noticed on this mailing list that it might
> have been related to JDK 1.5. So I've upgraded our environment to JDK
> 1.6 (along with upgrading logback to 1.0.1) and every seemed to be
> working fine.
>
> Then a few days ago, I didn't receive an e-mail from a STMPAppender
> event that I knew for sure I was supposed to get. I isolated and
> reproduced the event 10 consecutive times, with about 2 seconds between
> events. When I checked my email log, I only received 9 messages.
>
> I ran the test again, and got all 10 messages as expected. Tried again
> once more, and again got 10 messages. I decided to run my test one more
> time before I put it to rest, but this time I got 9 messages.
>
> After browsing the mailing lists for this issue, I saw Ceki's sample
> code (posted March 5) testing the ExecutorService. I clipped it out and
> tried it on my machine (running jdk1.6.0_31). I've found that this too
> was giving inconsistent results. Out of the three processes it suppose
> to execute, I get results of 3,3,1,0,0,3,3,1,3 .... I was surprised to
> see it not execute any processes at times. When running on JDK 1.5, I'm
> unable to get any results.

As you mentioned, setting ThreadPoolExecutor's corePoolSizeto 0 does not
work in JDK 1.5. Thank you for investigating this issue. As for
incomplete transmission under JDK 1.6, I am unable to reproduce the
problem unless System.exit() is invoked to exit the program.

Here is the application I am using.

package ch.qos.logback.classic.issue.lbclassic232;

import ch.qos.logback.core.Context;
import ch.qos.logback.core.ContextBase;

public class Barebones {

   public static void main(String[] args) {
     Context context = new ContextBase();
     for(int i = 0; i < 3; i++) {
       SenderRunnable senderRunnable = new SenderRunnable(""+i);
       context.getExecutorService().execute(senderRunnable);
     }
     System.out.println("done");
     //System.exit(0);
   }

   static class SenderRunnable implements Runnable {
     String id;
     SenderRunnable(String id) {
       this.id = id;
     }

     public void run() {
       try {
         Thread.sleep(2000);
       } catch (InterruptedException e) {
       }
       System.out.println("SenderRunnable " +id);
     }
   }
}

Now that the problem affecting JDK 1.5 has been identified a fix on the
way. This should fix http://jira.qos.ch/browse/LBCLASSIC-323

> Anyways, that's my 0.02 cents that I can offer on this. If there's any
> other help I can offer pleas let me know

Dave, thank you for investigating this problem. Much appreciated.

> -dave
--
Ceki
http://twitter.com/#!/ceki
_______________________________________________
Logback-user mailing list
Logback-user@...
http://mailman.qos.ch/mailman/listinfo/logback-user