• 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

Logging does not show anything

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am doing the simplest kind of file logging. I modified a few things in logging.properties in the jre/lib folder like:
1. Commented out ConsoleHandler since wanted to use the FileHandler:
#handlers= java.util.logging.ConsoleHandler
handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler

2. Modified the level of the logging like:
.level= ALL

3. Modified the level of the ConsoleHandler and added FileHandler level.
java.util.logging.ConsoleHandler.level = ALL
java.util.logging.FileHandler.level = ALL

In my code, I just use the default logging like:

1. Instantiate:
private Logger log = Logger.getLogger("suncertify.ui");

2. Use it like:
log.info("Invalid parameter passed in startup: " + args[0]);

I am puzzled as to why I am not seeing any .log file in my home directory. Am I doing something wrong here? Please advise. Thank you.
 
Ranch Hand
Posts: 332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm creating new handler for this, I didn't modify anything in logging.properties, which I think is not a good idea, because then your logging could work differently on assessor's machine.

 
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Nina Binde:
I am doing the simplest kind of file logging. I modified a few things in logging.properties in the jre/lib folder like:
1. Commented out ConsoleHandler since wanted to use the FileHandler:
#handlers= java.util.logging.ConsoleHandler
handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler

2. Modified the level of the logging like:
.level= ALL

3. Modified the level of the ConsoleHandler and added FileHandler level.
java.util.logging.ConsoleHandler.level = ALL
java.util.logging.FileHandler.level = ALL

In my code, I just use the default logging like:

1. Instantiate:
private Logger log = Logger.getLogger("suncertify.ui");

2. Use it like:
log.info("Invalid parameter passed in startup: " + args[0]);

I am puzzled as to why I am not seeing any .log file in my home directory. Am I doing something wrong here? Please advise. Thank you.





I wouldn't change anything in the properties file. You can set things up programmatically, and you aren't allowed to use a properties file for logging anyways. See John's posting.
 
Nina Binde
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you John and Rinke. I did as you guys told and lo and behold it worked!
 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you need to add the file handler to the logger...


application.log is the log file name.
 
I hired a bunch of ninjas. The fridge is empty, but I can't find them to tell them the mission.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic