Exception Manager (4.1) Logging to Trace Listener (creates separate file)

Topics: Exception Handling Application Block, Logging Application Block
Jan 20, 2009 at 4:20 PM
VS2008; EntLib 4.1; .Net 3.5; Windows Forms App:

I configured my XML trace listener and bound it to the Logging Errors and Warnings special source.
I also bound the listener to the General "Category Source"
I configured my EMAB for policy "Log", Exception "Exception", and bound the Logging Handler using XML Exception formatter, Category=General.
When I run my program, the first call to either Logger.Write or ExceptionPolicy.HandleException generates the desired XML log file. When I call the other method, it generates a separate log file using {GUID}{logfilename}. All subsequent calls to either method, logs to the same different file it originally logged to... It appears that the Logger and ExceptionPolicy classes are separately locking the tracing file causing the second class invoked to log to a separate file. How can I get the 2 classes to log to the same trace listener file instance?
Jan 21, 2009 at 3:08 AM
Try setting the UseDefaultLogger property of the LoggingHandler to true.  This will cause it to write every exceptions to the same file.

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.
Jan 21, 2009 at 3:28 AM
Thanks for the clarification.  I have Googled on the property and it does indeed work (and now I see that the setting was added in v4.0 of the library and, when set to false, does exactly what the documentation indicated and my experiences observed -- prepended the log file name with a GUID)...

(When I initially tried the recommended setting, I didn't realize at the time that the XMLTraceListener was not putting line breaks in the log file and when I opened it in a text editor I missed that the second entry was on the end of the first line making me believe that the setting was not for my situation...)