Log4net Users,
I am using the SmtpAppender. The documentation explains that the <to>
field can contain a list of e-mail addresses separated by semi-colons.
However, doing so, raises an exception in log4net:
<appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
<to value="[EMAIL PROTECTED];[EMAIL PROTECTED]" />
<from value="[EMAIL PROTECTED]" />
<subject value="Program-Monitor Operational Notification" />
<smtpHost value="smtpmail.mydomain.com" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%date{yyyy-MM-dd
HH:mm:ss.fff} [%-2thread] [%-5level] [%logger]
%message%newline%exception" />
</layout>
</appender>
Generates the following exception:
2008-04-02 10:07:28.777 [1 ] [ERROR] [SmtpLog] MyTest.TestLogger: SMTP
Log test - 2.
log4net:ERROR [SmtpAppender] Error occurred while sending e-mail
notification.
System.FormatException: The specified string is not in the form required
for an e-mail address.
at System.Net.Mime.MailBnfHelper.ReadMailAddress(String data, Int32&
offset, String& displayName)
at System.Net.Mime.MailBnfHelper.ReadMailAddress(String data, Int32&
offset)
at System.Net.Mail.MailAddressCollection.ParseValue(String addresses)
at System.Net.Mail.MailAddressCollection.Add(String addresses)
at log4net.Appender.SmtpAppender.SendEmail(String messageBody)
at log4net.Appender.SmtpAppender.SendBuffer(LoggingEvent[] events)
Press any key to continue . . .
IF, I use a comma separated list of e-mail addresses, it does work. So,
this is a simple work-around. However, it contradicts the
documentation. Has anyone else experienced a similar problem? Is the
documentation wrong? Am I making a mistake somewhere?
Thanks,
Ken Parrish
Gomez, Inc.