Logger Handler works for Eventlog but not flat file

Topics: Enterprise Library Core, Exception Handling Application Block, Logging Application Block, Policy Injection Application Block
Oct 12, 2008 at 11:39 AM
Hi all

I just create a simple Exception Handler which logs all the errors directly through Logging Handler. It works fine if I log the problem to eventlog but it won't work for flat file.

What is I missed? Thanks.

Regards
Alex
Oct 13, 2008 at 5:03 AM
Edited Oct 13, 2008 at 5:03 AM
Hi Alex,

Assuming that you already have the EHAB and LAB on the config.

You would need to:

1. Add a Flat File Trace Listener on the Trace Listeners Node and configure it (Set the Filename of the log file and the formattertype)
2. Add a new Category on the category node.
3. Add a new Trace Listener Reference.
4. Set the ReferencedTraceListener Property of the Trace Listener Reference to the Flat File trace listerner (created in the first step).
5. Add a Logging handler to the exception type, Set the Log Category Property to the Category created in step # 2. also set the FormatterType Property.


Hope this helps.


.Kratos
Oct 13, 2008 at 5:39 AM
Thanks.