How to use log4j pattern parser

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

Moderator: admin

Post Reply
Posts: 2
Joined: Mon Nov 30, 2015 9:49 am

How to use log4j pattern parser

Post by briandobby » Fri Jan 20, 2017 11:02 am

Hi, I'm trying to use the log4j pattern parser for the first time. I copied the pattern from my log4j2.xml file and pasted it into the dialog (see attached), but logmx doesn't parse my sample, and doesn't apply the parser to my log file.

What am I missing?
Screenshot from 2017-01-20 10-56-41.png
Screenshot from 2017-01-20 10-56-41.png (65.06 KiB) Viewed 7289 times

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

Re: How to use log4j pattern parser

Post by admin » Fri Jan 20, 2017 10:51 pm


I don't know why, but the logs you're trying to parse here don't properly match this pattern: while the pattern contains "%x " (Thread Context Stack / Nested Diagnostic Context), this information doesn't seem to be included in your logs. And we cannot say that this information is present as an empty string in your logs, because otherwise there would be two white-spaces between the logger and the message... (or maybe that's the case, it's not very clear in the screenshot). So I tested, and the logs are parsed correctly if you remove the extra "%x " in your LogMX pattern (i.e. "%x" and the following white space):

Code: Select all

%d [%t] %-5level %logger{36} - %msg

Post Reply