Can tinylog use the same configuration file for multiple applications (war's), but write the log based on the display-name in the web.xml?
Right now, all our web applications use log4j and share a configuration file. The log files are written with the following variable in the file name:
<RollingFile fileName="${web:servletContextName:-unknownContext}-${env:COMPUTERNAME:-unknownComputer}.%d{yyyy-MM-dd}.log" >
</RollingFile>
This means when our application has a display name of svc1234_FancyService and runs on SERVER001 then the log is named:
svc1234_FancyServce-SERVER001.2022-01-04.log
Can this behaviour be replicated with tinylog 2.4+?
Same Configuration File
You can place the tinylog configuration file anywhere on your file system and set the path via the system property
tinylog.configuration
. tinylog will automatically use the log file that is set in this system property. The system propertytinylog.configuration
can be set in yourweb.xml
files or globally via your application or web server configuration. For example, the global configuration file for JBoss EAP and Wildfly isstandalone.xml
.Log File Path
tinylog supports environment variables and date patterns by default. For the servlet context name, you will need a custom system property.
Example:
Then, you can set the system property
servlet.context.name
in theweb.xml
files for example.