logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From VolkerKopetzky ...@vzkb.de>
Subject How to set email message header with SMTPAppender and PatternLayout
Date Tue, 22 Jul 2014 11:29:56 GMT

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"/>

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	   +
skype	   volker.kopetzky
email	   vk@vzkb.de
wsite	   http://www.vzkb.de

View raw message