• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Logging in a jar

 
Ranch Hand
Posts: 62
  • 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
 
Bartender
Posts: 9559
12
Mac OS X Linux 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: 62
  • 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
Boost this thread!