Is there a way to set a single destination folder, such that I can specify where all log files should be created rather than having to set it on an appender by appender basis?
相关问题
- convert logback.xml to log4j.properties
- How do I load different logback configuration for
- How to limit the number of files per day when usin
- Configuring Logging for Unit Tests in Spring Boot
- Logback configuration daily rotate and zip monthly
相关文章
- How do I configure the location and name of tomcat
- Practical use of Logback context selectors
- Creating a custom layout in Logback
- Logback scan not working
- How to make Logback log a blank line, without incl
- Is it possible to find logback log files programma
- logback ThresholdFilter how todo the opposite
- How to get Environment properties from application
I've wasted a lot of time configuring Logback to work with Spring Boot and I'd like to share my configuration, hoping to save other people from wasting their time.
My example is similar to Andy Dufresne's above, with one key difference - no
<property>
tag. This was really important in my case because if you include the<property name="logs_dir" value="." />
you won't be able to override it using system properties, which I wanted to do like this:Also note the default value is set inside the path variable -
${logs_dir:-.}
. Hope this helps:You can define a property in the logback configuration file an use it as below
Note that logback can read the variables from System properties or a separate properties file too. Follow the manual for more details.