At runtime I often create/modify log4j Loggers, Appenders, Levels, Layouts, and time to time need to reset everything back to defaults.
Log4j
According to the documentation for the doConfigure
method:
Read configuration from a file. The existing configuration is not cleared nor reset. If you require a different behavior, then call resetConfiguration
method before calling doConfigure.
So I belive that calling LogManager.resetConfiguration()
and recall PropertyConfigurator.configure()
with the same files as on startup will do what you want.
The resetConfiguration()
method is documented in Hierarchy class.