Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Logger

 
Maria Lepschy
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have problems to enable Logging.
I have edited the logging.properties file and set the level to "ALL" and I set java.util.logging.FileHandler.pattern =C:\Java\Sun\Data.log
In my Data.lock method I call
Logger.getLogger("suncertify.db")
log.info("Got Lock = " + Thread.currentThread().getName());
On the console the following is shown:
Can't set level for java.util.logging.ConsoleHandler
16.04.2004 10:59:06 suncertify.db.Data lock
INFO: Got Lock = RMI TCP Connection(2)-192.168.1.33
Why the level can't be set? The Data.log is also not created.
Please help me.
Regards,
Maria
 
Min Huang
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
make sure you uncomment the line that enables the file handlers:

and comment out the line that only enables the console handler
and make sure the console level is set to all:
 
Maria Lepschy
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Min. Now the level is set on the ConsoleHandle.
I still have the problem that my Data.log isn't created. Or this file would not be created, just edited -that means I have to put an empty file?
Regards,
Maria
[ April 16, 2004: Message edited by: Maria Lepschy ]
 
Michael Hartman
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, it's easier to copy the logging.properties file from the JRE to your current working directory and make modifications to it there.
Second, you need to specify the following on the command line when starting your program so the JVM knows which logging.properties to use:

Third, in the logging.properties, you must specify the level at which your loggers should log. Add a line like this at the bottom:

Now, obviously, you can't expect the examiner to specify this logging.properties when he/she marks your assignment but it's a helpful debugging aid for you during development.
 
Maria Lepschy
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many thanks, Michael.
Regards,
Maria
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic