Officially, the configuration of tinylog 2 is immutable. The main reasons for having an immutable configuration are maintainability and performance (see benchmark).
However, if you know what you do, the configuration of tinylog 2 can be reloaded at runtime with a few hacks. You will find everything you need in this repository.
Steps for enabling reconfiguration:
- Create a custom logging provider that re-initializes the native tinylog logging provider when reloading the configuration: ReconfigurableLoggingProvider.java
- Create a custom no-op writer that doesn't output anything, but can be used in the tinylog configuration to prevent JVM runtime optimizations that would prevent reconfiguration otherwise: BlackHoleWriter.java
- Register the custom logging provider and custom no-op writer in META-INF/services and in your tinylog.properties.
- Happy reconfigurable logging for you application :)
Limitations:
- The writing thread must be not enabled