Problem: Optional "Message" field

Here developers can talk about how to write a Parser for LogMX

Moderator: admin

Post Reply
firefighter
Posts: 2
Joined: Tue Oct 05, 2010 12:01 pm

Problem: Optional "Message" field

Post by firefighter »

Dear All

I just started with LogMX and I run into a simple problem while analysing logfiles from a robot: Some of my entries do have a "Message" others don't. It looks like the parse fails whenever an entry has no "Message". I hope this can be solved without a java class parser:

Here some example lines from my logfiles:

Code: Select all

2010-09-23 18:13:56,469 INFO MxDrive:Y: sajet_motion.MotionController.driveActionDone: driveName = [Y] 
2010-09-23 18:13:56,469 INFO MxDrive:Y: sajet_motion.MotionController.driveActionDone: action = [move]
2010-09-23 18:13:56,589 INFO MxDrive:S: drive_maxon.MxDrive:S.executeMoveToReferencePosition
2010-09-23 18:13:56,619 INFO MxDrive:S: drive_maxon.MxDrive:S.enterStateOperationEnable: maxon state = ON
2010-09-23 18:13:56,619 INFO MxDrive:S: drive_maxon.MxDrive:S.enterStateOperationEnable: write parameters


I tried to use the log4jpattern parser:

Code: Select all

%d{yyyy-dd-MM HH:mm:ss,SSS} %p %u{Controller} %c %m
Caused by the 3rd line without a "Message" the whole 3rd line in my example is appended at the "Message" of the second line.

Thanks for any ideas...
apnakon
Posts: 10
Joined: Mon Oct 04, 2010 11:30 am

Re: Problem: Optional "Message" field

Post by apnakon »

HI Firefighter,

Did you try to use a simple parser, using ':' as a delimiter?

I'm new to LogMX as well, so I hope this is useful.

Cheers,

Adrian.
admin
Site Admin
Posts: 555
Joined: Sun Dec 17, 2006 10:30 pm

Re: Problem: Optional "Message" field

Post by admin »

Hello,

Nice try Adrian, but using a Simple parser will cause the same problem (it internally uses a backed-log4j parser :wink:)

Here is a Java Class Parser, tested with your log format: http://www.logmx.com/downloads/forum/SampleParser2.java.
Here is how to build this parser: http://www.logmx.com/p_parser_dev.php

Feel free to post a message if you don't get to use this parser.
Xavier.
firefighter
Posts: 2
Joined: Tue Oct 05, 2010 12:01 pm

Re: Problem: Optional "Message" field

Post by firefighter »

Thank you both Adrian and Xavier

@Adrian: I tried many hour with the Simple Parser and the Log4j pattern parser before asking for help in this forum. I tried all possible combinations of " ", ": ", ":", ... before i finnaly gave up. :(

@Xavier: The Java Class Parser is runnig! (I am responsable for an international servcie hotline but I could hardly keep up with your response time :o )


Regards,

Reto
Post Reply