Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 769281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:18:41+00:00 2026-05-14T18:18:41+00:00

Is it possible to use the Enterprise Library 4.1 TraceListeners without using the entire

  • 0

Is it possible to use the Enterprise Library 4.1 TraceListeners without using the entire Enterprise Library Logging AB? I’d prefer to simply use .NET Diagnostics Tracing, but would like to setup a listener that sends emails on Error events. I figured I could use the Enterprise Library EmailTraceListener. However, my initial attempts to configure it have failed. Here’s what I hoped would work:

<system.diagnostics>
  <trace autoflush="false" />
  <sources>
    <source name="SampleSource" switchValue="Verbose" >
      <listeners>
        <add name="textFileListener" />
        <add name="emailListener" />
      </listeners>
    </source>
  </sources>
  <sharedListeners>
    <add name="textFileListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="..\trace.log" traceOutputOptions="DateTime">
      <filter type="System.Diagnostics.EventTypeFilter" initializeData="Verbose" />
    </add>
    <add name="emailListener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EmailTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging" toAddress="to@example.com" fromAddress="from@example.com" smtpServer="mail.example.com" >
      <filter type="System.Diagnostics.EventTypeFilter" initializeData="Verbose" />
    </add>
  </sharedListeners>
</system.diagnostics>

However I get

[ArgumentException: The parameter 'address' cannot be an empty string.
Parameter name: address]
   System.Net.Mail.MailAddress..ctor(String address, String displayName, Encoding displayNameEncoding) +1098157
   System.Net.Mail.MailAddress..ctor(String address) +8
   Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.EmailMessage.CreateMailMessage() +256
   Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.EmailMessage.Send() +39
   Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EmailTraceListener.Write(String message) +96
   System.Diagnostics.TraceListener.WriteHeader(String source, TraceEventType eventType, Int32 id) +184
   System.Diagnostics.TraceListener.TraceEvent(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, String format, Object[] args) +63
   System.Diagnostics.TraceSource.TraceEvent(TraceEventType eventType, Int32 id, String format, Object[] args) +198
   System.Diagnostics.TraceSource.TraceInformation(String message) +14

Which leads me to believe the .NET Tracing code does not care about the “non-standard” config attributes I’ve supplied for emailListener. I also tried adding the appropriate LAB configSection declaration and:

<loggingConfiguration>
  <listeners>
    <add toAddress="to@example.com" fromAddress="from@example.com" smtpServer="mail.example.com" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EmailTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging" name="emailListener" />
  </listeners>
</loggingConfiguration>

This also results in the same exception. I figure it’s possible to programmatically configure the EmailTraceListener, but I prefer this to be config-driven. I also understand I can implement my own derivative of TraceListener.

So, is it possible to use the Ent Lib TraceListeners, without using the whole Ent Lib LAB, and configure them from the config file?

Update: After examining the code, I have discovered it is not possible. The Ent Lib TraceListeners do not actually utilize the config attributes they specify in overriding TraceListener.GetSupportedAttributes(), despite the recommendations in the .NET TraceListener documentation. Bug filed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T18:18:42+00:00Added an answer on May 14, 2026 at 6:18 pm

    For this specific purpose, I have used the lightweight UKADC.Diagnostics library in several projects now.
    It gets you an easy to use SMTPTraceListener and a SQLTraceListener for free.

    http://ukadcdiagnostics.codeplex.com/wikipage?title=SmtpTraceListener&referringTitle=Home

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to use Enterprise Manager 2005 with sqlserver 2005 express? I want
Is possible to use ArcSDE API in .NET(C#) ? http://edndoc.esri.com/arcsde/9.2/api/capi/dbconnects/dbconnects.htm Thanks
How do I configure the Enterprise Library Logging Application Block to place the log
I'm building UI logging into a long-existing ASP.NET enterprise application. I have my own
I've got a WCF service that's using Enterprise Library for its Exception Handling and
I've got some WCF services (hosted in IIS 6) which use the Enterprise Library
Is it possible to mock the enterprise library 5 version of 'Database'? If so...
I use Enterprise library caching application block. The specifics of our requirements required me
Is it possible use getline() to read a valid file without setting failbit ?
Is it possible to use external activation on sql express without going thru sql

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.