For 'EmailTraceListner' need to remove default prefix for 'subjectLineEnder'

Topics: Logging Application Block
Sep 24, 2014 at 5:41 PM
Edited Sep 24, 2014 at 5:42 PM

I am using Enterprise loggig V 6.0 for 'EmailTraceListner', i am getting default 'subjectLineEnder' prefix that is 'Information'.

I need to remove that.

I tried removing severity property of LogEntry class, but in this that case it takes default one.

Please suggest the solution to removing the default prefix for this.

Here is my 'EmailTraceListner' listener configuration looks like -

<add name="Email Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EmailTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.EmailTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
       formatter="Text Formatter" toAddress="kbansod@myemailcom" fromAddress="kamal.bansod@myOtheMmailcom" subjectLineStarter="LTS Error" subjectLineEnder=" "
       smtpServer="" smtpPort="587" authenticationMode="UserNameAndPassword" userName="myUserName" password="MyPassword" useSSL="true" />
Sep 26, 2014 at 4:14 AM
The EmailTraceListener sets the subject of the email to include the Severity of the LogEntry:
string sendToSmtpSubject = header + logEntry.Severity.ToString() + footer;
Unfortunately, this behavior is built in to the Logging Application Block and there are no configuration settings available to change it.

If you need to change the subject you will have to either modify the Enterprise Library source code to set the subject to the format you want. Or, if you don't want to modify the core block, then you can create a custom trace listener (and associated configuration classes) based on the EmailTraceListener and set the subject without the Severity.

Randy Levy
Enterprise Library support engineer
Support How-to
Sep 29, 2014 at 3:23 PM
Hi Randy,

Thanks for your reply, this information is useful for us to plant things in future.