[logback-user] SMTPAppender Subject

alex alessandro.fustini at dnshosting.it
Tue Aug 26 15:23:34 CEST 2008


Hi,
I use this declaration in logback.xml with resin 3.1.6, logback 0.9.9, 
and slf4j 1.5.2

<configuration>
<appender name="email" class="ch.qos.logback.classic.net.SMTPAppender">
    <Subject>Error on Application</Subject>
    <SMTPHost>localhost</SMTPHost>
    <To>error at pippo.it</To>
    <From>error at pippo.it</From>
    <layout class="ch.qos.logback.classic.PatternLayout">
      <pattern>%ex</pattern>
    </layout>
  </appender>
<root>
    <level value="error"/>
    <appender-ref ref="email"/>
  </root>
</configuration>

The emails for errors works but there are two problem :

1) In the Subject with my description is present all error message from 
stacktrace like this
Subject : Error on Application java.lang.NullPointerException    at 
it.dnshst.action.log.LoginAction.doAction(LoginAction.java:74)    at 
it.dnshst.action.BaseAction.runAction(BaseAction.java:221)  .....
 How is possible to remove it (Stack trace) and only have my subjetc ?
2) In the body the of message there is a bad multi mime format like this

at
 com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:164)

	at
 com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:187)

	at
 com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:266)

	at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:270)

	at com.caucho.server.port.TcpConnection.run(TcpConnection.java:678)
	at
 com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:721)
	at
 com.caucho.util.ThreadPool$Item.run(ThreadPool.java:643)
	at
 java.lang.Thread.run(Thread.java:619)
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_0_30676599.1219740931876"

------=_Part_0_30676599.1219740931876
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

2008-08-26 10:55:30,999 [http--8080-4] ERROR it.dnshst.servlet.MyDispatch - Error in Action for class it.dnshst.action.log.LoginAction
java.lang.NullPointerException
	at it.dnshst.action.log.LoginAction.doAction(LoginAction.java:74)
	at it.dnshst.action.BaseAction.runAction(BaseAction.java:221)
	at it.dnshst.servlet.MyDispatch.doPost(MyDispatch.java:177)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:153)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:91)
	at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:103)
	at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:164)
	at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:187)
	at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:266)
	at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:270)
	at com.caucho.server.port.TcpConnection.run(TcpConnection.java:678)
	at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:721)
	at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:643)
	at java.lang.Thread.run(Thread.java:619)

-----=_Part_0_30676599.1219740931876--

How is possible to have it correctly formatted ?

Thanks a lot fro all help


More information about the Logback-user mailing list