This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread 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 Murach's Java Servlets and JSP this week in the Servlets 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: 8834
    
    7

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.
 
Consider Paul's rocket mass heater.
 
subject: Logging in a jar
 
Similar Threads
Executable JAR File Problem
Hibernate+GWT problem related to slf4j
Websphere 3.5, Log4j 1.2.7
Jar file in jar file
package org.apache.log4j does not exist (Ant build compile)