logging application block-how configure different listeners for different severity?

Topics: Logging Application Block
Jan 17, 2009 at 9:24 AM
I have a categorySource(e.g. "MyApp")that can have log entries of different severity. I want that only errors will be send to e-mail listerner, but all entries to EventLog 
E.g. is the following allowed?
      <add switchValue="All" name="MyApp">
                 <add name="EventLog Listener" />

      <add switchValue="Error" name="MyApp">
                <add name="EMail TraceListener" />
In other words, should categorySource name be unique, or I can create multiple add elements with the same name, but different switchValue?

Also can I apply something like "Priority Filter" for the individual  categorySource? If I understand correctly, Priority Filter is global and effects all categories.
Jan 17, 2009 at 2:48 PM


You can try setting the "Filter" property of your tracelistener. But you must understand the meaning of the values that is available for that property.

Member name Description
<!----> ActivityTracing Allows the Stop, Start, Suspend, Transfer, and Resume events through. 
<!----> All Allows all events through. 
<!----> Critical Allows only Critical events through. 
<!----> Error Allows Critical and Error events through. 
<!----> Information Allows Critical, Error, Warning, and Information events through. 
<!----> Off Does not allow any events through. 
<!----> Verbose Allows Critical, Error, Warning, Information, and Verbose events through. 
<!----> Warning Allows Critical, Error, and Warning events through. 

Yes, your right priority filter is a global switch.

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.