Line Numbers (log4j)

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

Moderator: admin

Post Reply
xplodersuv
Posts: 3
Joined: Thu Nov 06, 2008 4:10 am

Line Numbers (log4j)

Post by xplodersuv »

I am trying to show the line numbers in logmx with no luck. Here is my logging statement

INFO 2008-11-05 17:38:02,138 MyClass(64) - This is the message

and my pattern is %-5p %d %C{1}(%l) - %m\n

I can't get it to display the line number next to the class name. I have tried upper and lower case version of 'L' without any luck.

The parser recognizes I'm trying to view the FullLocation but it shows up red. What is causing this and how can I fix it.
admin
Site Admin
Posts: 555
Joined: Sun Dec 17, 2006 10:30 pm

Post by admin »

Hello,

LogMX displays this field ("FullLocation") in red because it's not a LogMX native field like Level, Emitter, Message, ... and is not displayed in a dedicated column in the main log entries table.
To display this "extra" field as a prefix in the column "Message", click the button "Tags settings >>" in the parser creation dialog. A new table appeared on the right: check the column "Include in Message field" of line "FullLocation".

This pattern also seems to include two mistakes:
  • The pattern should end with "%n" instead of "\n"
  • "%-5p %d" means: at least 5 characters for a log Level, a white-space, and a Date.
    But your log entry example starts with "INFO 2008...": 4 characters for a log Level, a white-space, and a Date.
    (note: maybe you really have 2 white-space characters after "INFO" but this HTML forum displays only the first white-space character...)
xplodersuv
Posts: 3
Joined: Thu Nov 06, 2008 4:10 am

Post by xplodersuv »

Thanks! Exactly the answer I was looking for. And as a side bonus, thanks for pointing my \n mistake out!
Post Reply