Search code examples
javajava.util.loggingapache-commons-logging

How to make logging.properties and commons-logging.properties property files working?


I have two property files in my default package (I'm using NetBeans):

commons-logging.properties with property:

org.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger

and logging.properties with:

handlers=java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level=SEVERE

java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter

I'm getting INFO level messages in output. What i'm doing wrong? I also haven't found any information about JDK configuration, just example as above.


Solution

  • I'm not sure why you have .level=SEVERE appended on the last line, it should just like this:-

    handlers=java.util.logging.ConsoleHandler
    java.util.logging.ConsoleHandler.level=SEVERE
    java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter