EntLib Exception Logging: wrong time

Jul 27, 2013 at 12:22 AM
Edited Jul 27, 2013 at 12:43 AM

I used EntLib Exception and Logging Block, but the time in log file doesn't represent now time


7/27/2013 7:39:21 AM
HandlingInstanceID: 32475e39-86fc-4ca9-a838-9a993fdf6193

An exception of type 'MySql.Data.MySqlClient.MySqlException' occurred and was caught.

07/27/2013 07:39:21
Type : MySql.Data.MySqlClient.MySqlException, MySql.Data, Version=, Culture=neutral, PublicKeyToken=c5687fc88969c44d
Message : Unable to connect to any of the specified MySQL hosts.
Source : MySql.Data
Help link :
Number : 1042
ErrorCode : -2147467259
Data : System.Collections.ListDictionaryInternal
TargetSite : Void Open()
HResult : -2147467259
Stack Trace : at MySql.Data.MySqlClient.NativeDriver.Open()
at MySql.Data.MySqlClient.Driver.Open()
at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
at MySql.Data.MySqlClient.MySqlPool.GetConnection()
at MySql.Data.MySqlClient.MySqlConnection.Open()
at GTMP.MiddleTier.DAL.PointsTransactionDAL.GetPointsTransactionsFromMySQLByDateRange2(DateTime startdate, DateTime endDate) in D:\Projects\VS2010\GoTronikMemberPoint\GTMP.MiddleTier.DAL\PointsTransactionDAL.cs:line 339

Additional Info:

MachineName : ALPHACOM
TimeStamp : 7/27/2013 12:39:21 AM
FullName : Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
AppDomainName : GTMP.PresentationTier.Con.vshost.exe
ThreadIdentity :

WindowsIdentity : ******

as you can see TimeStamp in Additional Info doesn't represent current time (7:39:21 AM)
I already add (local) in my timespan
Jul 27, 2013 at 6:20 PM
The Logging Application Block allows you to control the format of time stamps via the template. However, when using the Exception Handling Application Block the Message property of the LogEntry is formatted using an ExceptionFormatter (the default being the TextExceptionFormatter). The default ExceptionFormatter behavior uses DateTime.UtcNow for setting the Additional Info TimeStamp property so it is not possible to change using configuration.

Unfortunately, if you want to customize the format of the Message property set by the Exception Handling Application Block then you would have to create a custom ExceptionFormatter.

Randy Levy
Enterprise Library support engineer
Support How-to
Marked as answer by randylevy on 10/7/2013 at 11:07 PM
Jul 28, 2013 at 11:08 PM
So it is the default ExceptionFormatter, thank you for your information randylevy