• Post Reply Bookmark Topic Watch Topic
  • New Topic

java logger  RSS feed

 
Stefan Gerber
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I have a problem with the java logger. I have 2 loggers and i want that they log there information in 2 different files.

the first logger is defined as Logger.getLogger("A")
the second logger is defined as Logger.getLogger("B.1.C")

now if i log something at the second logger. The log entries also appear at the file of the first logger. What i'm doging wrong?

thanks
 
Gamini Sirisena
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try defining a new java.util.logging.FileHandler for each file and them to each logger
using the addHandler method..
 
Stefan Gerber
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Thanks, for the answer. I found the problem. The solution is that you must disable the parent logger .there is a flag called setUseParentHandlers that must be disabled if you don't want that all entries are logged to the parent logger aswell

 
akhter wahab
Ranch Hand
Posts: 151
Java MyEclipse IDE Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stefan Gerber wrote:Hello Thanks, for the answer. I found the problem. The solution is that you must disable the parent logger .there is a flag called setUseParentHandlers that must be disabled if you don't want that all entries are logged to the parent logger aswell


 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!