简体   繁体   中英

Java logging - Default logging level

What exactly is the purpose of default logging level in my log property file? Eg:

.level = INFO

If I log something, I have to provide a log level anyways:

java.util.logging.Logger.log(Level.SEVERE, "Log some error")

So whats the point of defining a default log level if it overridden anyways?

That first line defines what comes out . The call to 'log' marks that message as SEVERE. The .level line says, 'output anything at INFO or more severe'. So a call to log at level DETAIL or DEBUG or whatever would be ignored.

It is not overriden.

the .level=INFO doesn't define a filter, it defines a threshold.

The log INFO is a "level". The default levels are

TRACE, DEBUG, INFO, WARN, ERROR and FATAL

If your current level is INFO then any logs with level INFO, WARN, ERROR, and FATAL are printed

If your current level is ERROR then any logs with level ERROR and FATAL are printed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM