Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# .NET4
Dear,
 
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.
File.Delete(logFilePath);
Scenario:
    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):
 
[...]
Logger.Writer.Dispose();
File.Delete(logFilePath);
[...]
Posted 30-Dec-10 23:44pm
ziadb86711
Edited 31-Dec-10 0:36am
v2

1 solution

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

Solution 2

Answered only to remove from unanswered list...
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 274
1 Shweta N Mishra 216
2 PIEBALDconsult 210
3 Sergey Alexandrovich Kryukov 185
4 BillWoodruff 174
0 OriginalGriff 7,620
1 Sergey Alexandrovich Kryukov 6,937
2 DamithSL 5,586
3 Manas Bhardwaj 4,946
4 Maciej Los 4,495


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 31 Dec 2010
Copyright © CodeProject, 1999-2014
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