Values for TimeStampPattern

Topics: General discussion, Logging Application Block
Nov 9, 2007 at 7:15 PM
I thought Id post my findings for the valid patterns for the TimeStampPattern property of Rolling Flat File Trace Listeners as it was not available in the documentation. Entlib calls the ToString on a DateTime instance with the formatter paramater set to the value of TimeStampPattern so the values available are those that the ToString() allows on a DateTime instance. These were provided by msdn docs:

Value : Exmaple output format
===== : ==========
d : 08/17/2000
D : Thursday, August 17, 2000
f : Thursday, August 17, 2000 16:32
F : Thursday, August 17, 2000 16:32:32
g : 08/17/2000 16:32
G : 08/17/2000 16:32:32
m : August 17
r : Thu, 17 Aug 2000 23:32:32 GMT
s : 2000-08-17T16:32:32
t : 16:32
T : 16:32:32
u : 2000-08-17 23:32:32Z
U : Thursday, August 17, 2000 23:32:32
y : August, 2000
dddd, MMMM dd yyyy : Thursday, August 17 2000
ddd, MMM d "'"yy : Thu, Aug 17 '00
dddd, MMMM dd : Thursday, August 17
M/yy : 8/00
dd-MM-yy : 17-08-00

Sep 23, 2009 at 5:46 PM

hey, thanks a lot. unfortunately it seems as if the entlib doesn't use the right culture info. so in germany the timestamp shows the time with 2hours difference. is there a solution?

Sep 23, 2009 at 5:54 PM
Edited Sep 23, 2009 at 5:56 PM

consider using UTC/GMT ('r', 'u', or 'U' from above) ?

Sep 23, 2009 at 6:27 PM
Edited Sep 23, 2009 at 7:52 PM

hmm, some patterns from above don't work. but that's not that disturbing. the real problem is the data in the log file. i'm using the 'timestamp' token. same problem. and there's no way to change anything at all....that's really annoying.

Sep 24, 2009 at 9:50 AM

Hi,

You can configure the LAB to use your local time as the timestamp. Please see this FAQ item: http://entlib.codeplex.com/Wiki/View.aspx?title=How%20can%20I%20change%20the%20timestamp%20format%20of%20my%20log%20entries%20to%20my%20local%20time%3f&referringTitle=Home

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Sep 24, 2009 at 6:37 PM
AvanadeSupport wrote:

Hi,

You can configure the LAB to use your local time as the timestamp. Please see this FAQ item: http://entlib.codeplex.com/Wiki/View.aspx?title=How%20can%20I%20change%20the%20timestamp%20format%20of%20my%20log%20entries%20to%20my%20local%20time%3f&referringTitle=Home

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

 

Hi,

perfect! Everything works fine.