• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.util.logging config file

 
Michael Remijan
Author
Ranch Hand
Posts: 131
7
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Sun's documentation on their configuration file for their logging package is not very good. What I'd like to know is if it is possible to use the logging configuration file to assign a class a certain handler? Say I have 1 class, org.moss.myapp.SQLExecutor that I want logging to go to a file instead of the console. Can this be done with the logging configuration file or does it have to be done programmatically?
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Michael,

For that I guess we have to know what is the logger name used by that class. Now, if logger name is not mentioned in the documentation of that class and if we don't have source then we can try and decompile the class to see what logger name is it using.

Once we know logger name then we can configure it in the config file to go to some other destination then console.

Also, before anything we have to know if the class is really using logging or just System.out.printlns in which case I don't see a clear solution to your problem.

I am assuming that the class we want to control logging for is not written by you (as I see org...things).

Regards
Maulin
 
Michael Remijan
Author
Ranch Hand
Posts: 131
7
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Once we know logger name then we can configure it in the config file to go to some other destination then console.


Um the point of my question was to find out what the entries in the config file will look like. So, for example, I want the logging org.javaranch.Foo to go to a rolling Foo.txt file and I want to change the logging level to finest. Using the config file, I know how to change the logging level:

org.javaranch.Foo.level = FINEST

What I don't know how to do is use the config file to create a rolling Foo.txt and assign it to the org.javaranch.Foo logger.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic