logging-log4j2
logging-log4j2 copied to clipboard
Avoid levels like `INFO#org.apache.log4j.Level`
If somebody (for example an external library) uses the deprecated Priority class there will be a custom level created even though there already exists a corresponding level.
Generated by gradle/develocity-actions
@jonasrutishauser,
Nice catch!
Looking at the o.a.l.Priority class there are other things that can go wrong:
Priority.version2Levelcan benull. This might lead to incorrect filtering ofPriorityinstances (possibly even an NPE). Can you create a new package-private constructor that always sets this field to a non-nullvalue:this.version2Level = version2Equivalent != null ? version2Equivalent : OptionConverter.createLevel(this);- The
Priority.FATAL,Priority.ERRORand so on fields reference theLevelsubclass, which might lead to class loading deadlocks on some JVMs (or they might just benullon others). Can you create them using the new constructor instead? - Can you add test cases to
LevelTestandPriorityTestto check if all the constants have the expected Log4j 2 level?
@jonasrutishauser,
Thank You for your contribution!