How to create Parse for own log File

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

Moderator: admin

Posts: 1
Joined: Thu Dec 06, 2007 5:49 am

How to create Parse for own log File

Postby praveena_chordia » Thu Dec 06, 2007 5:50 am

I want to use Parser for Parsing my own Logfile with diffrent field other than ParsedEntry.

How can I do that ?

I think for that I need my OwnEntity like ParedEntry which can have field which I want
also I need to change
"void addEntry(ParsedEntry)" function which can take my Entity. but that is not possible because it is final..

What steps should I Follow for that

Waiting for your kind response


Praveena Chordia

Site Admin
Posts: 418
Joined: Sun Dec 17, 2006 10:30 pm

Postby admin » Fri Dec 07, 2007 12:39 am


At this time, I suggest you 3 different solutions, depending on what you need:
  1. Write your own class "MyEntity" that extends "ParsedEntry". This way, you can set any attribute you want on "MyEntity" and use it the same way you use "ParsedEntry" (i.e. using "void addEntry(ParsedEntry)" with "MyEntity" will be OK)
  2. Store your own information in "extraInfo" attribute of class "ParsedEntry". If you have many fields, you can store a HashMap, HashTable, List or any collection you want in this "extraInfo" attribute (see Parser-dev API)
  3. Store your own information in 'message' field of your "ParsedEntry" (appending your fields at the beginning or at the end of the entry message)
Using 1. and 2., you will not see your fields in LogMX (useful only when you want to store some information you need to compute entry date in "get[Absolute/Relative]EntryDate()")

Using 3., you will see your fields in the 'Message' column of the entries list.

But this post may match your need:
it talks about a new feature that will be developed in one of our next releases: each ParsedEntry will have an hash table to store any number of user-defnined fields that will be displayed in LogMX, just as other fields, in its own column. Other features like search, filter, alert, export, ... will then be able to 'see' these user-defined fields like it does with fields 'Message', 'Level', 'Thread', etc...


Return to “Writing a Parser”

Who is online

Users browsing this forum: No registered users and 1 guest