• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Logging does not show anything

 
Nina Binde
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • 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.
 
John Stone
Ranch Hand
Posts: 332
  • Mark post as helpful
  • send pies
  • 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.

 
rinke hoekstra
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thank you John and Rinke. I did as you guys told and lo and behold it worked!
 
Musab Al-Rawi
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you need to add the file handler to the logger...


application.log is the log file name.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic