-
Notifications
You must be signed in to change notification settings - Fork 474
Description
Describe the bug
The GCRun class creates a logger based off the class and the current datalevel.
| this.log = LoggerFactory.getLogger(level.name() + GCRun.class); |
As a result, the logger name is not properly formatted.
given a datalevel = "ROOT"
expected logger name = ROOTorg.apache.accumulo.gc.GCRun
actual logger name = ROOTclass org.apache.accumulo.gc.GCRun
This was not noticed in the log output as the layout pattern uses a precision specifier of [%c{2}] to only show the last two items in the logger name.
| appender.console.layout.pattern = %d{ISO8601} [%c{2}] %-5p: %m%n |
Current Workaround
The current logger can be targeted in a log4j2.properties file with proper character escaping.
logger.gc.name = ROOTclass\ org.apache.accumulo.gc.GCRun
logger.gc.level = debug
logger.gc.additivity = false
Expected behavior
At minimum, the class string and spacing should be removed from the logger name.
That can be accomplished by calling getName() on the GCRun.class
LoggerFactory.getLogger(level.name() + GCRun.class.getName());
Additional Improvements
Given the precision specifier that's used, I'm wondering if the datalevel should be switched to a suffix.
This would allow it to be displayed in the log format [gc.GCRunROOT] as opposed to being hidden [gc.GCRun].