Skip to content

Latest commit

 

History

History
16 lines (10 loc) · 1.25 KB

File metadata and controls

16 lines (10 loc) · 1.25 KB

Reload tinylog configuration at runtime

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:

  1. Create a custom logging provider that re-initializes the native tinylog logging provider when reloading the configuration: ReconfigurableLoggingProvider.java
  2. 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
  3. Register the custom logging provider and custom no-op writer in META-INF/services and in your tinylog.properties.
  4. Happy reconfigurable logging for you application :)

Limitations:

  • The writing thread must be not enabled