This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Java in General and the fly likes Logging in a jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Logging in a jar" Watch "Logging in a jar" New topic
Author

Logging in a jar

Gabriel Beres
Ranch Hand

Joined: Sep 09, 2006
Posts: 61
Hi!

I using log4j, to log my inner workings of my code.
My problem is, when my codes are in a jar file, log4j can't figure out the exact line number, where an event has happened for example:

java.lang.Exception
at my.package.MyClass.myMethod(Unknown Source)

In eclipse, there are no problem, because the source files are there.
How can i attach sources to a jar file, so log4j could find the exact line?

Thanks
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8876
    
    8

Take a look at the compiler documentation and look for the "-g" options. They add debug information to generated class files.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Gabriel Beres
Ranch Hand

Joined: Sep 09, 2006
Posts: 61
Thanks Joe!

javac -g works great.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Logging in a jar