nifi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James McMahon <jsmcmah...@gmail.com>
Subject How does logging level get set?
Date Tue, 11 Sep 2018 12:28:28 GMT
Good morning. I am confused about logging levels from within java code that
defines a nar.

I have a java class file AMQPWorker.java, within which I establish a logger
used throughout my nar. This is what I inherited in the class:

abstract class AMQPWorker implements AutoCloseable {
     private final static Logger logger =
LoggerFactory.getLogger(AMQPWorker.class);

Later in this class there is a method that appears to check the log level
prior to publishing a message to the log, like so

     if (logger.isDebugEnabled()) {
          logger.debug("some debug message");
     }

When this if statement is executed, what exactly is being checked to verify
whether isDebugEnabled() returns true or false?
I can't find anywhere that the log level is set within the code.
How does the logging level get set?
Does the nar somehow inherit the logger properties set in logback.xml?
And if it does, wouldn't we always want the logging configuration in
logback.xml to be the level that allows any logging level from within the
code, a la logger.debug(), .info(), .warn(), etc?

Bottom line for me: throughout my code I want to be sure when I use a
particular logging level to determine if a message gets logged to my logger
or not, that level is respected.

Thank you for any help.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message