• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Logging in a jar

 
Gabriel Beres
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9256
9
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at the compiler documentation and look for the "-g" options. They add debug information to generated class files.
 
Gabriel Beres
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Joe!

javac -g works great.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic