errors with timeline and date settings

Notes, tips, and other usefull things on how to use LogMX

Moderator: admin

Post Reply
jpierce
Posts: 51
Joined: Thu Mar 21, 2019 3:51 pm

errors with timeline and date settings

Post by jpierce »

I've written a java parser that make entry dates look like "2019-03-22 15:56:10". I have

Code: Select all

    private final static SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(

    @Override
    public Date getAbsoluteEntryDate(ParsedEntry parsedEntry) throws Exception {
        // TODO: kludge that will eventually have to be fixed
        return DATE_FORMAT.parse(parsedEntry.getDate());
    }
This works just fine. If I load the file and then turn the timeline on, it's fine. If I reload the file after the timeline is own, it's fine.

However, if I go under the Tools->Display and check "Display log entries date with custom format" (even leaving the default date format of "d MMM yy HH:mm:ss.SSS"), things get buggy. If I turn that setting on and have the timline off, I can load and reload the file without any problem. If I turn the timeline on and reload the file, I get:

Image

and the grid window looks like this (ignore my gray color setting):
Image

In all these cases, the data is not changing.
admin
Site Admin
Posts: 555
Joined: Sun Dec 17, 2006 10:30 pm

Re: errors with timeline and date settings

Post by admin »

Hello,

This seems not good indeed. Two things come to my mind:
  1. the first one would be the timezone, that would explain this weird message saying that "2019-02-13 00:12:57" is not between "Wed Feb 13 00:00:06 CST 2019" and "Wed Feb 13 23:10:32 CST 2019". If the timezone used to interpret "2019-02-13 00:12:57" is not CST, that would explain this issue. To check the TimeZone currently used by LogMX, go to menu "Help", "About", then click on the blue "i" icon at the bottom left corner, and check the value of "user.timezone" in the top part ("System properties").
  2. the second one would be how your SimpleDateFormat is used in your Parser: its "parse()" method should be called within a "synchronized (DATE_FORMATTER_MUTEX) { ... }" block, as shown in the example "<LogMX-dir>/parsers/src/sample/parser/SampleParser.java". Because if the same SimpleDateFormat is used by mutiple threads at the same time, invalid dates can be produced.
If it still doesn't work, please send me your log file and your Parser (in your message, the definition of DATE_FORMAT is truncated), I should be able to fix the problem if I'm able to reproduce it. (to send it to me, you can use this thread, or a Private Message on this forum, or support@logmx.com)

Xavier
jpierce
Posts: 51
Joined: Thu Mar 21, 2019 3:51 pm

Re: errors with timeline and date settings

Post by jpierce »

It's using America/Chicago, which is the correct one.

Again, though, this only happens if I go and change the "Display log entries date with custom format". Without that checked, it has no problem.
jpierce
Posts: 51
Joined: Thu Mar 21, 2019 3:51 pm

Re: errors with timeline and date settings

Post by jpierce »

Here's what I have no. Let me know if I'm doing that right:

Code: Select all

    private final static Object DATE_FORMATTER_MUTEX = new Object();

    @Override
    public Date getAbsoluteEntryDate(ParsedEntry parsedEntry) throws Exception {
        synchronized (DATE_FORMATTER_MUTEX) {
            return DATE_FORMAT.parse(parsedEntry.getDate());
        }
    }

    @Override
    public Date getRelativeEntryDate(ParsedEntry parsedEntry) throws Exception {
        return getAbsoluteEntryDate(parsedEntry);
    }
As far as sending you a log file, I'll have to work on trimming one down to a test case that doesn't expose any confidential information.
jpierce
Posts: 51
Joined: Thu Mar 21, 2019 3:51 pm

Re: errors with timeline and date settings

Post by jpierce »

jpierce wrote: Tue Mar 26, 2019 5:58 pm It's using America/Chicago, which is the correct one.

Again, though, this only happens if I go and change the "Display log entries date with custom format". Without that checked, it has no problem.
I take that back. I did find a case where it would happen even without that unchecked. This could be a different situation, as it didn't show the messed up Timestamp data like int the screenshot. But many of them showed 2020-08-20 00:07:40 as their timestamp so I'm working on figuring that out.
jpierce
Posts: 51
Joined: Thu Mar 21, 2019 3:51 pm

Re: errors with timeline and date settings

Post by jpierce »

jpierce wrote: Tue Mar 26, 2019 6:16 pm
jpierce wrote: Tue Mar 26, 2019 5:58 pm It's using America/Chicago, which is the correct one.

Again, though, this only happens if I go and change the "Display log entries date with custom format". Without that checked, it has no problem.
I take that back. I did find a case where it would happen even without that unchecked. This could be a different situation, as it didn't show the messed up Timestamp data like int the screenshot. But many of them showed 2020-08-20 00:07:40 as their timestamp so I'm working on figuring that out.
Well, that was interesting. I figured out that it was munging a date! Happy to have that sorted out. I think I had not figured it out before because it only happened when certain emitters were on.

Thanks for the help.
admin
Site Admin
Posts: 555
Joined: Sun Dec 17, 2006 10:30 pm

Re: errors with timeline and date settings

Post by admin »

Sorry I'm late to the party. Do you mean that it's not a problem with LogMX but more the dates in the log file?
jpierce
Posts: 51
Joined: Thu Mar 21, 2019 3:51 pm

Re: errors with timeline and date settings

Post by jpierce »

Yes! I think it was just being hard to debug because I only ran into it with certain log lines, which were the ones the parser had put an extra "2019" onto.
Post Reply