1

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

.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?

1
  • That's not log4j, that's java.util.logging. Commented May 16, 2014 at 23:19

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

2

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.