How to debug our own parser ?

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

Moderator: admin

Post Reply
hugo
Posts: 2
Joined: Sat Oct 27, 2007 3:30 pm

How to debug our own parser ?

Post by hugo »

Hi,

I'm trying to do my own parser that read a file in json format. I write the parser and a junit test that just open a file and call the "parseLine" method with the first line of my file.
It works, the parsedEntry is good (or seems to be).

In debug mode, the parsed entry before the end of the method is :

[Entry id=-1, date=2007-10-25 12:29:29.961000, level=INFO, thread=null, emitter=my.package.manager, message=my message...]

But in logmx, I do not load the file.
I launched logmx with this options "-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=7456" to be able to debut it in eclipse.
But of course, I just saw my class, I don't have the source code for the other classes.
My parser is correctly called and the entry are correctly filled.

What did I missed ?
hugo
Posts: 2
Joined: Sat Oct 27, 2007 3:30 pm

Post by hugo »

Sorry, was my fault. I missed to add the entry with addEntry(entry).
admin
Site Admin
Posts: 555
Joined: Sun Dec 17, 2006 10:30 pm

Post by admin »

You're right, that's the solution.

If you need more information on how to write parsers:
  • http://www.logmx.com/p_parser_dev.php
  • Directory "help/parsers_api/" (or "help/api/" since v1.2.2) of your LogMX directory (API javadoc)
  • Directory "parsers/src/sample/" of your LogMX directory (Parser sample)
Xavier
Post Reply