On a parsing error, add option to ignore line

If you think LogMX needs a new useful feature!
Post Reply
isheedm
Posts: 109
Joined: Wed Sep 12, 2007 2:16 pm

On a parsing error, add option to ignore line

Post by isheedm »

I was trying to setup a Simple parser and everything looked OK at first.

In loading a file, I got an error where it found a string that didn't look like a "level". The only options I have are:
  • add this level...
  • don't add this level and switch to the next parser
  • abort file load
I would like to ignore the current line and keep going. Any ignored lines could go into another tab so you can see where the trouble was and maybe fix the parser. I would also like to have more feedback on what line the error occurred. This way, I might be able to see most of the log entries. If I get too many errors, I would have to adjust my parser.
admin
Site Admin
Posts: 555
Joined: Sun Dec 17, 2006 10:30 pm

Re: On a parsing error, add option to ignore line

Post by admin »

Hello,

When this error occurs, it should mean that your parser is not correctly set up, and/or your log file is malformed. In both cases, I don't understand why you would still want to load the file completely.
Moreover, LogMX can't display a log entry with an unknown (i.e. undeclared) log level. So we cannot add an option "keep loading file with this parser (without adding level)".

Xavier
isheedm
Posts: 109
Joined: Wed Sep 12, 2007 2:16 pm

Re: On a parsing error, add option to ignore line

Post by isheedm »

Usually this occurs for me when one or two of the log messages has an extra newline in it that throws off the parser. (an empty line shows up in the message). Most log entries are OK, it is just a few that are malformed.

If it would be possible to ignore data until you find a log entry that is parsable, it would help.

However, if you can add a line number to the error message that comes up, that will help me find the source of the error too. Seeing the text is helpful, but I may have many messages with that text in them so it isn't clear which one caused the problem.

Also, if the parsing of the message could be more tolerant of newlines, that would be an improvement. I don't have a good test case handy, but if I remember correctly, if the "message" part of the log entry starts with an empty line (two newlines), that throws off the parser.
admin
Site Admin
Posts: 555
Joined: Sun Dec 17, 2006 10:30 pm

Re: On a parsing error, add option to ignore line

Post by admin »

Handling of extra new lines in "Message" field is entirely performed by the Parser. So whether it is well handled or not entirely depends on the Parser you use.

Error messages for unknown or invalid log levels are now displaying the line number (in LogMX v3.1.0 that will be released in a near future). Plus, any Log Parser can now get the current line number thanks to a new public method in class LogFileParser (LogMX API).

Xavier
Post Reply