Created
July 7, 2016 13:34
-
-
Save tolitius/71735deeb5c5326adccc5585508a37f5 to your computer and use it in GitHub Desktop.
log4j 2.0: changing DEFAULT_PREFIX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Changing "DEFAULT_PREFIX": https://logging.apache.org/log4j/2.0/log4j-core/apidocs/src-html/org/apache/logging/log4j/core/config/ConfigurationFactory.html#line.108 | |
| Field prefix = ConfigurationFactory.class.getField( "DEFAULT_PREFIX" ) | |
| prefix.setAccessible( true ); | |
| Field mods = Field.class.getDeclaredField( "modifiers" ); | |
| mods.setAccessible( true ); | |
| mods.setInt( prefix, prefix.getModifiers() & ~Modifier.FINAL ); | |
| field.set( null, "logger-config" ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment