• Post Reply Bookmark Topic Watch Topic
  • New Topic

getSourceClassname() in java.util.logging.LogRecord gives null in which scenario?  RSS feed

 
shashantrika loganathan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm using LogRecord_object.getSourceClassName() to retrive the source class. But i'm always getting null. can any one explain why is that happening? Is there any alternative method for that?
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java code can be compiled in such a way that source information (file name, line number, etc) is no longer available. If this occurs, stack traces show an unknown source. Unfortunately, LogRecord and other libraries won't be able to retrieve this information anymore. The only possible thing to do is to recompile the source code, if that's possible, to include the source information.
 
Campbell Ritchie
Marshal
Posts: 56598
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!