File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes java.util.logging config file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java.util.logging config file" Watch "java.util.logging config file" New topic
Author

java.util.logging config file

Michael Remijan
Author
Ranch Hand

Joined: May 29, 2002
Posts: 123
    
    5

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?


Java EE Evangelist — Author, EJB 3 in Action 2nd Edition — Java Community Process Member
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
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

Joined: May 29, 2002
Posts: 123
    
    5


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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.util.logging config file