[slf4j-user] Asynchronous SMTPAppender

Joe Wang jwang at io-works.com
Tue Jan 17 17:44:02 CET 2012


Makes sense.  Thanks!
Joe Wang

On Jan 17, 2012, at 11:40 AM, ceki wrote:

>
> Hi Joe,
>
> Lines 188 and 189 of SMTPAppenderBase should answer the question.  
> Please see http://goo.gl/czvS4
>
> HTH,
>
> -- 
> Ceki
> http://twitter.com/#!/ceki
>
>
> On 17.01.2012 17:17, Joe Wang wrote:
>> Hi,
>>
>> I see in the docs (http://logback.qos.ch/manual/appenders.html) it  
>> says
>> "SMTP email transmission (sending) is performed asynchronously". I'm
>> looking on grepcode.com at version 1.2.25. I can't see how it is  
>> sending
>> asynchronously.
>>
>> SMTPAppender.java
>>
>> void    [More ...]  <http://grepcode.com/file/repository.springsource.com/org.slf4j/com.springsource.slf4j.nlog4j/1.2.25/org/apache/log4j/net/SMTPAppender.java# 
>> >append  <http://grepcode.com/file/repository.springsource.com/org.slf4j/com.springsource.slf4j.nlog4j/1.2.25/org/apache/log4j/AppenderSkeleton.java#AppenderSkeleton.append%28org.apache.log4j.spi.LoggingEvent%29 
>> >(LoggingEvent  <http://grepcode.com/file/repository.springsource.com/org.slf4j/com.springsource.slf4j.nlog4j/1.2.25/org/apache/log4j/spi/LoggingEvent.java#LoggingEvent 
>> >  event)  {
>>
>> ...
>>
>> <http://grepcode.com/file/repository.springsource.com/org.slf4j/com.springsource.slf4j.nlog4j/1.2.25/org/apache/log4j/net/SMTPAppender.java# 
>> >
>>
>>            sendBuffer  <http://grepcode.com/file/repository.springsource.com/org.slf4j/com.springsource.slf4j.nlog4j/1.2.25/org/apache/log4j/net/SMTPAppender.java#SMTPAppender.sendBuffer%28%29 
>> >();
>>
>> ...
>>
>> }
>>
>>
>>
>>
>> void    [More ...]  <http://grepcode.com/file/repository.springsource.com/org.slf4j/com.springsource.slf4j.nlog4j/1.2.25/org/apache/log4j/net/SMTPAppender.java# 
>> >sendBuffer()  {
>>
>> ...
>>
>> <http://grepcode.com/file/repository.springsource.com/org.slf4j/com.springsource.slf4j.nlog4j/1.2.25/org/apache/log4j/net/SMTPAppender.java# 
>> >
>>
>>            Transport.send  <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java#Transport.send%28javax.mail.Message%29 
>> >(msg  <http://grepcode.com/file/repository.springsource.com/org.slf4j/com.springsource.slf4j.nlog4j/1.2.25/org/apache/log4j/net/SMTPAppender.java#SMTPAppender.0msg 
>> >
>>
>> );
>>
>>  ...
>>
>> }
>>
>>
>>
>> Transport.java
>>
>> public  static  void    [More ...]  <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java# 
>> >send(Message  <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Message.java#Message 
>> >  msg,  Address  <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Address.java#Address%5B%5D 
>> >[]  addresses)
>>
>> throws MessagingException
>> <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/MessagingException.java#MessagingException 
>> >
>> {
>> <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java# 
>> >
>>
>> 	msg.saveChanges  <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Message.java#Message.saveChanges%28%29 
>> >();
>>
>> <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java# 
>> >
>>
>> 	send0  <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java#Transport.send0%28javax.mail.Message%2Cjavax.mail.Address%5B%5D%29 
>> >(msg,  addresses);
>>
>> <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java# 
>> >
>>
>>        }
>>
>> <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java# 
>> >
>>
>> private  static  void    [More ...]  <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java# 
>> >send0(Message  <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Message.java#Message 
>> >  msg,  Address  <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Address.java#Address%5B%5D 
>> >[]  addresses)
>>
>> throws MessagingException
>> <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/MessagingException.java#MessagingException 
>> >{
>> ...<http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java# 
>> >
>>
>> <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java# 
>> >
>>
>> 	/*
>>
>> <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java# 
>> >
>>
>> 	  *  Optimize  the  case  of  a  single  protocol.
>>
>> <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java# 
>> >
>>
>> 	  */
>>
>> <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java# 
>> >
>>
>> 	if  (dsize  ==  1)  {
>>
>> <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java# 
>> >
>>
>> 	        transport  =  s.getTransport  <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Session.java#Session.getTransport%28javax.mail.Address%29 
>> >(addresses[0]);
>>
>> <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java# 
>> >
>>
>> 	        try  {
>>
>> <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java# 
>> >
>>
>> 		transport.connect  <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Service.java#Service.connect%28%29 
>> >();
>>
>> <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java# 
>> >
>>
>> 		transport.sendMessage  <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java#Transport.sendMessage%28javax.mail.Message%2Cjavax.mail.Address%5B%5D%29 
>> >(msg,  addresses);
>>
>> <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java# 
>> >
>>
>> 	        }  finally  {
>>
>> <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java# 
>> >
>>
>> 		transport.close  <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Service.java#Service.close%28%29 
>> >();
>>
>> <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java# 
>> >
>>
>> 	        }
>>
>> <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java# 
>> >
>>
>> 	        return;
>>
>> <http://grepcode.com/file/repository.springsource.com/javax.mail/com.springsource.javax.mail/1.4.1/javax/mail/Transport.java# 
>> >
>>
>> 	}
>>
>> ...
>> }
>>
> _______________________________________________
> slf4j-user mailing list
> slf4j-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/slf4j-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/slf4j-user/attachments/20120117/9cc4e90a/attachment-0001.html>


More information about the slf4j-user mailing list