Previous Next

Thread: Missing milliseconds in timestamps from custom plugin

Last post 08-11-2006 6:46 AM by LogParser User : WalterLeinert. 3 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (4 items)

Sort Posts:

  • 08-10-2006, 2:56 PM

    Missing milliseconds in timestamps from custom plugin

    Hi,

    i wrote a custom plugin in c# similar to the cluster log plugin to analyze log4net logfiles with the really great LogParser (!).

    Sample:

    2006-08-08 08:53:35,805 [3324] INFO  AppBase.PortalApplicationContext - >> Initialize

    2006-08-08 08:53:37,242 [3324] INFO  AppBase.PortalApplicationContext - >> PrecompileServices

    ...

    I create records with several fields e.g. method entry/exit time (data type DateTime in c#, with added millisecond part), method name, elapsed time ...

    All works fine when i use my plugin in LogParser. But it seems that the millisecond part is missing in my date/time fields:

    LogParser -i:COM -iprogid:MarkenLogParser.MarkenLog "SELECT TOP 2 Qualifier, Method, ThreadId,Entry FROM client-log-file.txt"

    Qualifier                           Method ThreadId Entry
    -------------------------- ------   -------- -------------------
    AppBase.ServicePrecompiler .ctor    3324      08.08.2006 08:53:36
    AppBase.ServicePrecompiler .ctor    3324      08.08.2006 08:53:36

    Statistics:
    -----------
    Elements processed: 2
    Elements output:    2
    Execution time:     0.49 seconds

    Does anyone know about this problem or has a workaround solution for me? Is this only a formatting problem has the milliseond part gone when the data is marshalled to COM datatype?

    Thanks in advance,

    Walter

  • 08-10-2006, 4:48 PM In reply to

    RE: Missing milliseconds in timestamps from custom plugin

    Did you try giving a time format that specifically includes ms?
    e.g. instead of SELECT Entry, try
    SELECT TO_STRING(Entry, 'MM.dd.yyyy hh:mm:ss,ll')

    Please forgive me if this is obvious, but I'm hoping it might be a simple problem.
  • 08-11-2006, 1:27 AM In reply to

    RE: Missing milliseconds in timestamps from custom plugin

    LogParser User : WalterLeinert:
    Quote: Did you try giving a time format that specifically includes ms? e.g. instead of SELECT Entry, try SELECT TO_STRING(Entry, 'MM.dd.yyyy hh:mm:ss,ll') Please forgive me if this is obvious, but I'm hopin...

    Hi Daniel,

    i tried your variant but it does not work; i get

    Method                TO_STRING(Entry, 'MM.dd.yyyy hh:mm:ss,l
    ------------------ ---------------------------------------
    OnApplicationExit   08.07.2006 08:25:58,000
    Main                    08.07.2006 08:23:25,000

    I added traces to my plugin to see if the millisecond part is contained in the date field; it is.

    May be there is a marshalling/compatibility issue between .NET DateTime and COM VT_DATE

    Walter

  • 08-11-2006, 6:46 AM In reply to

    RE: Missing milliseconds in timestamps from custom plugin

    LogParser User : WalterLeinert:
    Quote: Hi, i wrote a custom plugin in c# similar to the cluster log plugin to analyze log4net logfiles with the really great LogParser (!). Sample: 2006-08-08 08:53:35,805 [3324] INFO  AppBase.Portal...

    Hi,

    i found several hints that the fractional part of a second is cut when converting a DateTime to an OleAut VT_DATE (seems to a double internally).

    Therefore i changed all my date fields of the record to strings consisting of a sortable/comparable datetime pattern (e.g. "2006-08-07 08:23:25,352"), which can easily be used in queries:

    logparser -i:COM -iprogid:MarkenLogParser.MarkenLog "SELECT Qualifier, Method, User, Entry, Elapsed from server-log-file.txt WHERE Entry BETWEEN '2006-08-09 12:15:43,8' AND '2006-08-09 12:15:43,9' ORDER BY Entry" or

    logparser -i:COM -iprogid:MarkenLogParser.MarkenLog "SELECT Qualifier, Method, User, Entry, Elapsed from server-log-file.txt WHERE Entry > '2006-08-09 12:15' "

    Regards, Walter

Page 1 of 1 (4 items)
Page view counter