Good afternoon
The documentation for SLF4J and Logback is very detailed
😊, but unfortunately it is still difficult to understand the various possibilities and mechanisms, so I have a question:
Is it possible to configure the logback FileAppender
so that it automatically / dynamically creates logfile names based on a string which the developer passes in e.g.
LOGGER.trace()?
The background to the idea is as follows:
- The developer is programming a new module (e.g. a configuration manager)
and he would like to have the log entries summarised in a separate log file.
- Therefore, he calls something like that:
LOGGER.trace(“Config-Mgr”, “Message”)
- SLF4J / Logback automatically reads this string and create this Logfile:
AppLog-Config-Mgr.log
- The central element is that we do not have to modify logback.xml and create an appender for each Logfile.
This means that if the user now calls e.g.: LOGGER.trace(“User-Actionlog”, “Message”)
then this new log file will created without having to modify logback.xml:
AppLog-User-Actionlog.log
Thank you very much for any tips & tricks 😊
Thanks a lot, kind regards,
Thomas