The use case is to create an OS-based dynamic configuration file.
The script determines which appender to use (once), and instantiates that appender (once). There is no need for one appender to delegate to another appender.
This feature helps you build your configuration dynamically, all from the configuration file, to determine which appenders to configure. This is different from using a RoutingAppender which creates a level of indirection and decides what to do for each log event at runtime.
You can use multiple ScriptSelector Appenders if needed.
The new plugins are ScriptSelector (an Appender that builds a different ScriptSelector) and AppenderSet, a plugin with deferChildren set to true.
- relates to
LOG4J2-2176 ScriptAppenderSelector does not have JavaDoc and User Guide docs