• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Logger

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Many thanks, Michael.
Regards,
Maria
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic