Fix Logger.getEffectiveThreshold() to honor explicit LogLevel.ALL #5
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Logger.getEffectiveThreshold()currently uses a truthiness check:Since
LogLevel.ALL = 0, an explicit threshold ofLogLevel.ALLis treated as “unset”. That means a child logger cannot override a stricter parent threshold back down toALL.Reproduction
Expected
child.info(...)should be logged, because the child explicitly set its threshold toLogLevel.ALL.Actual
The child falls through to the parent threshold (
WARN), soINFOis dropped.Scope
Logger.getEffectiveThreshold()to use an explicitundefined/nullcheck instead of truthinessLogLevel.ALLunder a stricter parent threshold0-is-falsy patternNotes
LogLevel.ALL.