If the log file becomes an UTF-8 file for some reason unknown to me, the parsing of the date fails... the substring(0,19) will then get an invisible character (called the ByteOrderMark) and it will have one digit less of the seconds... causing the parse to fail most probably already because of the invalid character over the missing digit.
It would be nice if the code would strip the BOM, if present, before trying to split and parse the lines....
Unfortunately I couldn't reproduce the problem here but that could have something to do with different locales or something else interesting. I've submitted a pull request to fix this though, should help in your case. :)
Would be great if you could test, download this zip, backup your bin and App_Data folder and unzip the files from the zip into the root of your site. You might need to clear the cache in your browser before loading the log files (not sure if there's changes to the client side components but it doesn't hurt).
Thanks for the quick response, I have tried the update but it doesn't work... I have a sample log file that causes the exception (not all logfiles have it)
Can't seem to send you a PM so I'll post a link here (one time download, one day valid, pass: sandro)
UTF-8 file with BOM causes DateTime.Parse to fail
If the log file becomes an UTF-8 file for some reason unknown to me, the parsing of the date fails... the substring(0,19) will then get an invisible character (called the ByteOrderMark) and it will have one digit less of the seconds... causing the parse to fail most probably already because of the invalid character over the missing digit.
It would be nice if the code would strip the BOM, if present, before trying to split and parse the lines....
More info can be found here: http://stackoverflow.com/questions/1317700/strip-byte-order-mark-from-string-in-c-sharp
Hope it helps, nice work on the package!
Best regards,
Sandro Mastronardi
Unfortunately I couldn't reproduce the problem here but that could have something to do with different locales or something else interesting. I've submitted a pull request to fix this though, should help in your case. :)
https://github.com/DanDiplo/UmbracoTraceLogViewer/pull/3
Would be great if you could test, download this zip, backup your
bin
andApp_Data
folder and unzip the files from the zip into the root of your site. You might need to clear the cache in your browser before loading the log files (not sure if there's changes to the client side components but it doesn't hurt).Hang on, fix was wrong, fixing correctly now =)
Alright, try this one: https://dl.dropboxusercontent.com/u/3006713/TraceLogViewerBOMFix.zip
See : https://github.com/DanDiplo/UmbracoTraceLogViewer/pull/4 for fix approach.
Hi Sebastiaan,
Thanks for the quick response, I have tried the update but it doesn't work...
I have a sample log file that causes the exception (not all logfiles have it)
Can't seem to send you a PM so I'll post a link here (one time download, one day valid, pass: sandro)
http://nmd.sk/wkjTNFJ6
Best,
Sandro
Thanks Sandro, fixed the problem properly now, would be nice if you can confirm but with this log file I don't have that problem any more.
Updated dll: https://dl.dropboxusercontent.com/u/3006713/Diplo.TraceLogViewer.dll.zip
is working on a reply...