SamehMohamedEl-Sayed / elmah

Automatically exported from code.google.com/p/elmah
Apache License 2.0
0 stars 0 forks source link

Exception thrown when XmlErrorLog logdirectory does not exists and errors are listed by elmah.axd #205

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Configure Elmah to use XmlErrorLog, provide a log directory that is not 
created.
2. Go to elmah.axd to list errors in the nonexistent directory

What is the expected output? What do you see instead?

The expected output is an empty list of errors, similar or identical to the 
view shown when directory exists but is empty.

Instead the following exception is thrown:

[DirectoryNotFoundException: Could not find a part of the path 
'******************'.]
   System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +224
   System.IO.FileSystemEnumerableIterator`1.CommonInit() +245
   System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler) +556
   System.IO.DirectoryInfo.InternalGetFiles(String searchPattern, SearchOption searchOption) +64
   System.IO.DirectoryInfo.GetFiles(String searchPattern) +18
   Elmah.XmlFileErrorLog.GetErrors(Int32 pageIndex, Int32 pageSize, IList errorEntryList) +104
   Elmah.ErrorLogPage.OnLoad(EventArgs e) +336
   System.Web.UI.Control.LoadRecursive() +74
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207

What version of the product are you using? On what operating system?

Elmah 1.1 installed from NuGet

Please provide any additional information below.

Attached patch:
1) make GetErrors method check that the directory exists and if not found 
return zero results.
2) create LogPath if not found when adding a new log entry

Since there didn't seem to be any convention for integration testing (hitting 
filesystem) I did not create any tests for this. Sorry.

Original issue reported on code.google.com by jbei...@gmail.com on 11 Feb 2011 at 10:38

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by azizatif on 16 Feb 2011 at 9:48

GoogleCodeExporter commented 9 years ago

Original comment by azizatif on 16 Feb 2011 at 9:53

GoogleCodeExporter commented 9 years ago
Fixed in r791.

Original comment by azizatif on 16 Feb 2011 at 9:55