babgvant / elmah

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

SqlErrorLog does UTC offset correction twice #78

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. configure MSSQL error logging
2. create unhandled error condition
3.

What is the expected output? What do you see instead?
expect time in UTC (currently this would be ET+5) get UTC+5 (ET+10)

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

Please provide any additional information below.
Suspect problem is in SqlErrorLog.cs:

Class Commands
...
public static SqlCommand LogError(
...
parameters.Add("@TimeUtc", SqlDbType.DateTime).Value = time.ToUniversalTime();

But then the caller does the same thing:
public class SqlErrorLog : ErrorLog
...
public override string Log(Error error)
...
using (SqlCommand command = Commands.LogError( id, this.ApplicationName,
error.HostName, error.Type, error.Source, error.Message,
error.User,error.StatusCode, error.Time.ToUniversalTime(), errorXml))

Apologies in advanced if already fixed.

Cheers.

Original issue reported on code.google.com by saladp...@gmail.com on 21 Nov 2008 at 2:24

GoogleCodeExporter commented 9 years ago

Original comment by azizatif on 21 Nov 2008 at 2:50

GoogleCodeExporter commented 9 years ago
What version of ASP.NET are you using ELMAH 1.0.9414.11 in?

Original comment by azizatif on 21 Nov 2008 at 3:09

GoogleCodeExporter commented 9 years ago
Specifically, is this issue appearing when used under ASP.NET 1.x?

Original comment by azizatif on 21 Nov 2008 at 3:14

GoogleCodeExporter commented 9 years ago
This bug has been reproduced using ELMAH v1.0.10617 under ASP.NET 1.x. The time 
recorded in the MS SQL database is indeed at twice the UTC offset.

This bug does not occur under .NET Framework 2.0 or later because the DateTime 
type 
knows its "kind" and ignore the second conversion to UTC.

Thanks for pointing out the potential source of problem in the code.

Original comment by azizatif on 21 Nov 2008 at 3:55

GoogleCodeExporter commented 9 years ago
Fixed in r531. Thanks.

Original comment by azizatif on 21 Nov 2008 at 4:02

GoogleCodeExporter commented 9 years ago

Original comment by azizatif on 21 Nov 2008 at 7:53