BIND 10 #1071: introduce "null" output for logs

BIND 10 Development do-not-reply at isc.org
Wed Jun 29 14:17:02 UTC 2011


#1071: introduce "null" output for logs
-------------------------------------+-------------------------------------
                   Reporter:         |                 Owner:  stephen
  jinmei                             |                Status:  assigned
                       Type:  task   |             Milestone:
                   Priority:  major  |  Sprint-20110712
                  Component:         |            Resolution:
  logging                            |             Sensitive:  0
                   Keywords:         |           Sub-Project:  DNS
            Defect Severity:  N/A    |  Estimated Difficulty:  0.0
Feature Depending on Ticket:         |           Total Hours:  0
        Add Hours to Ticket:  0      |
                  Internal?:  0      |
-------------------------------------+-------------------------------------

Comment (by stephen):

 As it is possible to set a severity of NONE, a comment as to the
 distinction between doing that and setting the output to /dev/null is
 offered by way of explanation for this ticket.

 Logging is achieved using macros that effectively expand to something
 like:
 {{{
 if (logger.isDebugEnabled()) {
    logger.debug(...)
 }

 if (logger.isInfoEnabled()) {
    logger.info(...)
 }
 }}}
 If we set the logging severity to INFO, {{{isDebugEnabled()}}} will return
 false and {{{isInfoEnabled()}}} will return true.  Logging is disabled if
 the severity is set to NONE, as all the {{{isXxxEnabled()}}} methods
 return false and no methods on the logger that output text are called.

 Another way of disabling logging is to ignore the logging severity and
 route all output to {{{/dev/null}}}.  However, there is a difference
 between this and setting the severity to NONE.  Consider the case where
 the logging statement is:

 {{{
 if (logger.isDebugEnabled()) {
    logger.debug(..., expensive())
 }
 }}}
 ... where the argument {{{expensive()}}} is a function that may take a
 long time to run or be expensive in some other way (e.g. it converts a
 complicated data structure into text, or perhaps it locks the database for
 the duration of the call).

 If we set the logging severity to NONE, {{{expensive()}}} will never be
 executed.  This is exactly what we want in production, as we keep needless
 work to a minimum.

 On the other hand, setting the severity to DEBUG and the output to
 /dev/null is what is required in testing.  Needless output is still
 discarded, but all code paths - including those in arguments to the
 logging functions, such as {{{expensive()}}} in the example above - are
 tested.

-- 
Ticket URL: <http://bind10.isc.org/ticket/1071#comment:2>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list