logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: How to set email message header with SMTPAppender and PatternLayout
Date Tue, 22 Jul 2014 12:37:39 GMT
Remko shows 2.0 docs, this user is on 1.2...

Gary


On Tue, Jul 22, 2014 at 7:40 AM, Remko Popma <remko.popma@gmail.com> wrote:

> The PatternLayout has header/footer attributes to set some string for the
> beginning and end of each log file.
> http://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout
> I'm not sure if it will be included in every email but it is worth trying.
>
>
> On Tue, Jul 22, 2014 at 8:29 PM, VolkerKopetzky <vk@vzkb.de> wrote:
>
> > Hi,
> >
> > I'm using log4j 1.2.15.
> >
> > The Appender used for email is:
> >
> > <appender name="ErrorNotifier" class="org.apache.log4j.net.SMTPAppender">
> > <param name="Threshold" value="ERROR"/>
> > <param name="To" value="mail@somewhere.com"/>
> > <param name="From" value="mail@somewhere.com"/>
> > <param name="SMTPHost" value="smtp.mail.com"/>
> > <param name="BufferSize" value="100"/>
> > <param name="Subject" value="New Error!"/>
> > <layout class="org.apache.log4j.PatternLayout">
> > <param name="ConversionPattern" value="%-5p %d{ISO8601} - %m%n"/>
> > </layout>
> > </appender>
> >
> > This works nicely, yet I would like to add additional email message
> > headers to the message.
> >
> > Is that possible?
> >
> > If so, how can I add, for example this header to the email send by the
> > Appender:
> > X-System-Postid: post12345
> > X-System-Forumid: forum12345
> >
> > Many thanx in advance!!
> >
> > Beste Grüße, kind regards,
> > Volker Kopetzky
> > vzk Beratung
> > Germany & Thailand
> >
> > phone    +49.6809.2163.30
> > phone    +66.86.143.77.27
> > skype    volker.kopetzky
> > email    vk@vzkb.de
> > wsite    http://www.vzkb.de
> >
> >
> >
>



-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message