It's not a secret anymore!*
The moose likes Other Open Source Projects and the fly likes how to make log4j print out class name and line number Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "how to make log4j print out class name and line number" Watch "how to make log4j print out class name and line number" New topic
Author

how to make log4j print out class name and line number

Tien Duong Nguyen
Greenhorn

Joined: Oct 22, 2004
Posts: 22
Hi everyone,

I am looking for the way to print out the class name and line number in logging message.

E.g : logger.info ("message "); -> ClassName ( line number ) : message.

Can we do it with log4j

Regards,

Andy.


SCEA (part 1), part 2,3 in progress<br /> <br />SCBCD,SCWCD,SCJP
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42365
    
  64
That's possible. The PatternLayout javadocs have all the details.


Ping & DNS - my free Android networking tools app
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to make log4j print out class name and line number