GeeCON Prague 2014*
The moose likes Other Open Source Projects and the fly likes Not getting Line Numbers while logging with Log4j Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Not getting Line Numbers while logging with Log4j" Watch "Not getting Line Numbers while logging with Log4j" New topic
Author

Not getting Line Numbers while logging with Log4j

Devesh Chanchlani
Greenhorn

Joined: Sep 04, 2007
Posts: 19
Problem description: Getting "?" in place of line numbers, while logging with log4j. All other parameters are working. The details are given below:

Log4j.properties


Test.java


OUTOUT
[java] 2009-03-02 03:39:48 [ Test , main , ? ] DEBUG => LOGGER WORKING !!!


Thanks in Advance.
Devesh Chanchlani
Greenhorn

Joined: Sep 04, 2007
Posts: 19
Resolved the issue, just needed to change the ant script in the following manner:

<target name="compile" depends="prepare" description="Normal build of application">
<javac srcdir="src" destdir="${build.dir}" debug="on" debuglevel="lines,vars,source">
<classpath refid="compile.classpath"/>
</javac>
</target>
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Correct, line numbers will only be displayed when the code is compiled with the debug information.


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
 
GeeCON Prague 2014
 
subject: Not getting Line Numbers while logging with Log4j