Enterprise library email logging not working

Topics: Enterprise Library Core, Logging Application Block
Nov 24, 2010 at 10:07 AM

Hi there,

I'm working on a project in which I'm using the Enterprise Library. The logging is configured in code by using the Fluent configuration API: link.
I can log using all the provided tracelisteners (FlatFile,Database, EventLog, etc.), except for the EmailTraceListener. After configuring this listener, nothing is happening when i want to log a message. 

I have also made a simple test project where i configure the EmailTraceListener  using the the Enterprise library configuration in Visual Studio (2010). But this seems to make no difference.
Does anyone know what could be going wrong? There are no exceptions thrown.

The only thing i can see what is possibly going wrong is in the output that Visual Studio creates: 'A first chance exception of type 'System.Net.Mail.SmtpException' occurred in System.dll'

This is the configuration i am using ( I've changed the email addresses and smtpServer)

 
 <add name="Email Trace Listener" 
		type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EmailTraceListener, 
			Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.EmailTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                toAddress="myEmail@address.com" fromAddress="myEmail@address.com"
                smtpServer="smptServerAddress"
                subjectLineStarter="Test begin" subjectLineEnder="Test End"
                smtpPort="25"
                formatter="Text Formatter" authenticationMode="WindowsCredentials"
                useSSL="true" />

One other question. Can i specify multiple email addresses and CC/BCC addresses?

I hope that you guys can help me out. I have searched the internet for a while, but until now i have not find a solution yet.

Many thanks,

Arie Bubberman

Nov 24, 2010 at 12:39 PM

I suggest adding a trace listener under the Logging Errors and Warnings special category.  The effect is that whenever a logging failure occurs, that listener will be prompted to log for the exception which was thrown during logging.  If you configured the Event Log Trace Listener in that special category, check the event viewer for an error log, the details of the exception should be included in the message.

And yes, you can specify multiple email addresses by separating them using semi colon.

 

Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com


 
 
Nov 24, 2010 at 1:39 PM

Thank you for your response, i am going to try that. 

Arie Bubberman

 

Nov 25, 2010 at 2:07 PM

I have added the Event Log Tracelistener to the Logging Errors and Warnings special category, but nothing is logged. 

It seems to me that really nothing is happening. I have modified all of the settings in a way that the logging should give an error .

The settings I use to cause an error are the following:

  <add name="Email Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EmailTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.EmailTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                toAddress="123" fromAddress="456"
                subjectLineStarter="Test begin" subjectLineEnder="Test End"
                smtpServer="fooserver" smtpPort="212335" formatter="Text Formatter"
                authenticationMode="WindowsCredentials" useSSL="true" />

But nothing seems to happen.

Am i missing something?

Dec 3, 2010 at 8:37 AM
Edited Dec 3, 2010 at 8:45 AM

Did you confirm you are able to log using the event log trace listener?  If yes, then it would seem that the email trace listener is able to successfully send your log entry but for some reason it doesn't reach its destination.   I have experienced this on my local machine and the steps I've taken are mentioned below. 

  1. Right-Click on My Computer , click Manage
  2. Expand the Services and Applications node
  3. Expand the Internet Information Services
  4. Right-Click on the "Default SMTP Virtual Server" > Properties
  5. In the General tab, there is a IP address dropdown. try selecting your local IP address.
  6. Go to the Access tab
  7. Click the Relay button below.
  8. Select the "Only the list below" option
  9. Add your IP address on the list
  10. OK.

 

Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

 

Mar 23, 2011 at 6:51 AM

Hi,

I think most of the SMTP servers require authentication. SMTP authentication is not supported by Ent Library.

To do that, simply add smtp settings in your app.config/web.config file. The Ent Lib with send emails using those settings.

Let me know if this works for you.

 

Cheers !!!

Tushar

Jun 23, 2011 at 7:35 AM

Hi,

Even i am facing the same issue, and taken the steps mentioned but no use, please help on this, even i added smtp settings to my web.config file..

Jun 23, 2011 at 11:49 AM

Hi,

Did you find any exceptions on your Event Log?

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 23, 2011 at 12:32 PM

No, nothing is noted in the event log!, i am unable to identify the problem, except this email listner everything is working fine, even i tried putiing my gmail id with the password authentication but no use..if you want me give entire code in the config i will provide!

Jun 24, 2011 at 8:20 AM
Edited Jun 24, 2011 at 8:21 AM

Hi,

Can you send us a sample repro project? Send it to entlib.support@avanade.com

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 27, 2011 at 11:53 AM

I've received your repro project. I just noticed that your email trace listener is filtered to log only Errors. Note that your log entry should have also the severity of Error for the logging to work. If this is not the case, I suggest you to step through the code of EmailTraceListener class to see what happens internally.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 27, 2011 at 1:42 PM
Thanks for the reply,will try the way you suggested and update you for any doubts.
Thanks,
Bhargavi Deepti.

On Mon, Jun 27, 2011 at 4:23 PM, AvanadeSupport <notifications@codeplex.com> wrote:

From: AvanadeSupport

I've received your repro project. I just noticed that your email trace listener is filtered to log only Errors. Note that your log entry should have also the severity of Error for the logging to work. If this is not the case, I suggest you to step through the code of EmailTraceListener class to see what happens internally.

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Read the full discussion online.

To add a post to this discussion, reply to this email (entlib@discussions.codeplex.com)

To start a new discussion for this project, email entlib@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Nov 22, 2011 at 11:10 AM

Did any one get idea of how to specify multiple recipients  in TO field???

Nov 22, 2011 at 11:13 PM

Yes, you can specify multiple recipients. Simply separate each recipient with a semicolon (';').  At runtime Enterprise Library will split the "To" string and add each recipient as another MailAddress.

--
Randy Levy
Enterprise Library support engineer
entlib.support@live.com