This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes Log4J not printing line number Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Log4J not printing line number" Watch "Log4J not printing line number" New topic
Author

Log4J not printing line number

sarada bokka
Ranch Hand

Joined: Jan 13, 2010
Posts: 80
Hi All,

I am using apache Log4j when I execute my program it doesn't print line numbers for the CustCommJDBC class

The only difference between CustCommJDBC and Letter class is static

Letter : private Logger logger = Logger.getLogger(CLASSNAME);
CustCommJDBC : private static Logger logger = Logger.getLogger(CLASSNAME);

I have changed letter logger to static but it still works fine.

Log file:

10:27:24,424 0 [main] INFO CustCommJDBC:? - Loading JDBC driver - Started
10:27:25,346 922 [main] INFO CustCommJDBC:? - Loaded driver - End
10:27:25,346 922 [main] INFO CustCommJDBC:? - establishing Connection - Started
10:27:26,298 1874 [main] INFO CustCommJDBC:? - established Connection - End
10:27:26,298 1874 [main] INFO Letter:345 - end of init method
10:27:26,314 1890 [main] INFO Letter:101 - EXECUTE LETTER - STARTED
10:27:26,314 1890 [main] INFO Letter:104 - create directories - Started
10:27:26,439 2015 [main] INFO Letter:106 - create directories - End
10:27:26,439 2015 [main] INFO Letter:118 - EXECUTE LETTER - END

Could any one let me know what I am missing :-(
sarada bokka
Ranch Hand

Joined: Jan 13, 2010
Posts: 80
It's Eclipse IDE problem

goto Java Compiler -> add line number attributes

uncheck and apply

again check and apply.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Log4J not printing line number
 
Similar Threads
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
How to use Log4j implement singleton ?
Not getting Line Numbers while logging with Log4j
Logging into different files based on parameters
Issue with JBoss logging for different jboss instances running on same machine