Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XmlFileErrorLog exception when non XML files are in the same folder #45

Closed
GoogleCodeExporter opened this issue Sep 14, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link

Retrieving errors with the XmlFileErrorLog throws an exception if the
folder the logPath configuration attribute points to contains other files,
non-XML or XML but with a different scheme - say, not containing error logs.

Original issue reported on code.google.com by simone.b...@gmail.com on 8 Nov 2007 at 3:12

@GoogleCodeExporter
Copy link
Author

How do you reckon this happens? Looking at the code 
(http://elmah.googlecode.com/svn/trunk/src/Elmah/XmlFileErrorLog.cs, r211
), there is a filtering on the naming pattern at the following lines:

Line #142:
string path = Path.Combine(LogPath, string.Format(@"error-{0}-{1}.xml", 
timeStamp, 
errorId));

Line #247:
string[] files = Directory.GetFiles(LogPath, string.Format("error-*-{0}.xml", 
id));

Original comment by azizatif on 8 Nov 2007 at 3:44

  • Added labels: Component-Persistence

@GoogleCodeExporter
Copy link
Author

I didn't look into the code, I just noticed that the error case happened when I 
had a
file named Elmah.db in the same folder where the errors logged by the XML 
provider
were. Removing the file from there solved the problem.

Original comment by simone.b...@gmail.com on 8 Nov 2007 at 3:54

@GoogleCodeExporter
Copy link
Author

Yep, you're right. Seems like line #179 is the culprit (that I missed the first 
time):

  FileSystemInfo[] infos = dir.GetFiles();

One could argued that the log path should be void of types of files but I guess 
it's 
a simple case to rule out so why not.

Original comment by azizatif on 8 Nov 2007 at 4:02

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Yes, I was getting back to you on this. Not too hard to solve.

Original comment by simone.b...@gmail.com on 8 Nov 2007 at 4:08

@GoogleCodeExporter
Copy link
Author

Fixed in r240.

Original comment by azizatif on 8 Nov 2007 at 4:38

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant