File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Logging Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Logging" Watch "Logging" New topic
Author

Logging

Simon Ingram
Ranch Hand

Joined: Nov 30, 2003
Posts: 171
Hi folks,
I tried this question on the SCJD forum but no one seemed interested. I am trying to set up my system to log low level messages, but I'm not having success. On the LogManager class, the Sun docs say that you can edit the logging.properties file to configure logging for your system. Now how does one do this editing? I tried opening the file with everything I could lay my hands on. No luck, so I tried changing the extension from .properties to .txt. The file was readable and everything inside was exactly as expected. I changed the log level from INFO to ALL, then switched the extension back to .properties and put it into HOME/jre/lib where it came from. I added a few logging messages, but nothing lower than INFO appears. Clearly there are other ways to do this, but that's not the point! How does one edit the logging.properties file?
Any feedback would be greatly appreciated!
Simon
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
I don't what happen with ur properties file... For my program, which use properties file to configure the database info, I can edit it, even manually...
If u can provide some code snippets, then I guess we can help u more....


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
Simon Ingram
Ranch Hand

Joined: Nov 30, 2003
Posts: 171
Hi Ko Ko,
Thanks for you answer. When you say you can edit the file manually, do you mean the way I describe, changing the extension to .txt, editing and then changing the extension back to .properties or do you edit the file some other way? In any event you have to open the file. How?
As for a code snippet:
package com.ingasimn;
public void presentResultSet(ResultSet rs) throws SQLException {
Logger.getLogger("com.ingasimn").entering("EV009","presentResultSet");
// code in here
Logger.getLogger("com.ingasimn").exiting("EV009","presentResultSet");
Logger.getLogger("com.ingasimn").info("exit presentResultSet");
}
when I run the program, the info message appears on the console, but not the FINER level "exiting" message.
Regards, Simon
Maverick Lasa
Greenhorn

Joined: Oct 18, 2003
Posts: 23
hello simon,
properties file is merely a text file. you can edit using
any text editor. you may assign your default text editor
to .properties extension thus you don't have to change the
file extensions in order to open them on text editors.
mavedrive;
Simon Ingram
Ranch Hand

Joined: Nov 30, 2003
Posts: 171
Maverick,
I had come to the same conclusion, thanks for the confirmation!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Logging
 
Similar Threads
Is TOMCAT'S JULI logging levels broken on Linux?
Logging
NX: which logging file?
How do I customize JDK logging?
slf4j logging issue - log file not getting generated