As I understand, /logfile actuator available only if logging.file=
is in the application.properties file.
But for my logging I need RollingFileAppender file appender with SizeAndTimeBasedRollingPolicy.
Is it possible to configure RollingFileAppender in the application.properties?
If I configure RollingFileAppender in the logging-spring.xml there is an error:
java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - 'File' option has the same value "log/scratch6.log" as that given for appender [FILE] defined earlier.
Is it possible to have logfile via RollingFileAppender and have a /logfile actuator?
I faced the same issue. Here is what i found
logging.file - actually creates a file. when you declare ${LOG_FILE} in your logback-spring.xml, it detects a collision. appender and file name with the same value.
I ended up doing this (appending with .log so that it differentiates the appender with the file)
application.properties: logging.file=/opt/fff/logs/file_debug
logback-spring.xml:
<file>${LOG_FILE}.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>
%d{yyyy-MM-dd HH:mm:ss} - %msg%n
</Pattern>
</encoder>
..
However it also creates another file /opt/fff/logs/file_debug in addition to /opt/fff/logs/file_debug.log
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With