Can't setup log4j parser for plain text logs

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

Moderator: admin

Post Reply
Paska
Posts: 2
Joined: Tue Oct 06, 2009 10:31 am

Can't setup log4j parser for plain text logs

Post by Paska »

Hi!
I'm trying to set up log4j parser for plain text log4j log files, here is an example of the log:

Code: Select all

09:02:09,916: WARN  [EventQueue-0:CommonUtils] System property "nms.home" is not defined, using default.
09:02:09,963: DEBUG [Worker-1:com.company1.SnmpSession] SnmpSession(peer=192.0.0.251) - start
Configuration of log4j:

Code: Select all

<layout class="org.apache.log4j.PatternLayout">
    <param name="ConversionPattern" value="%d{ABSOLUTE}: %-5p [%t:%c] %m%n"/>
</layout>
Configuration of LogMX:

Code: Select all

org.apache.log4j.PatternLayout="%d{HH:mm:ss,SSS}: %-5p [%t:%c] %m%n
Image

But LogMX can't find suitable parser for the log file. Can you explain me please what exactly i did wrong?
Thanks.[/code]
admin
Site Admin
Posts: 555
Joined: Sun Dec 17, 2006 10:30 pm

Post by admin »

Hello,

The pattern you gave to LogMX should not contain "org.apache.log4j.PatternLayout=", so you just have to replace:

Code: Select all

org.apache.log4j.PatternLayout="%d{HH:mm:ss,SSS}: %-5p [%t:%c] %m%n
with

Code: Select all

%d{HH:mm:ss,SSS}: %-5p [%t:%c] %m%n
and it should works! (I've tested this pattern with LogMX v1.3.3 and it's OK)

Let me know if you don't manage to make it work.
Xavier.
Paska
Posts: 2
Joined: Tue Oct 06, 2009 10:31 am

Post by Paska »

admin wrote:Hello,

The pattern you gave to LogMX should not contain "org.apache.log4j.PatternLayout=", so you just have to replace:

Code: Select all

org.apache.log4j.PatternLayout="%d{HH:mm:ss,SSS}: %-5p [%t:%c] %m%n
with

Code: Select all

%d{HH:mm:ss,SSS}: %-5p [%t:%c] %m%n
and it should works! (I've tested this pattern with LogMX v1.3.3 and it's OK)

Let me know if you don't manage to make it work.
Xavier.
Hi Xavier!
It's work, thanks. I'm going to test it and may be I'll recommend to management of my comapny to buy a few licences.

Thanx again!
Post Reply