Click here to Skip to main content
11,927,378 members (46,200 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# .NET .NET4

I'm using the enterprise library 5.0 in order to register the exception thrown into a log file in a windows WPF application.
ExceptionPolicy.HandleException(exception, "ExceptionPolicy");
And also I have added the functionality in order to delete the file on click.
    1. If the log file is full but no exception has been raised:
      >> The file is deleted smoothly.
    2. If the log file is full and an exception is raised:
      >> An additional exception is raised informing that the file could not be deleted because it is used by another process.

EDIT ================

I have found the solution, all I have to do is:

Add reference to the enterprise Logging DLL:

using Microsoft.Practices.EnterpriseLibrary.Logging;

And then add Logger.Writer.Dispose(); before File.Delete(logFilePath):

Posted 30-Dec-10 23:44pm
Edited 31-Dec-10 0:36am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Answered only to remove from unanswered list...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151126.1 | Last Updated 31 Dec 2010
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100