spring boot - Actuator /logfile endpoint no longer works with external logback configuration -
i needed logs rolling, have created "logback-spring.xml" file , placed src/main/resources. works flawlessly.
the issue actuator endpoint "/logfile" no longer works have removed logging configuration "applications.yml" file. according documentation, either "logging.path" or "logging.file" needs set in order make "/logfile" endpoint work. seem conflict new 'xml configuration.
here logback-spring.xml configuration measure:
<configuration debug="true" scan="true"> <include resource="org/springframework/boot/logging/logback/base.xml"/> <property name="log_path" value="logs"/> <property name="log_archive" value="${log_path}/archive"/> <appender name="rollingfile-appender" class="ch.qos.logback.core.rolling.rollingfileappender"> <file>${log_file}</file> <rollingpolicy class="ch.qos.logback.core.rolling.timebasedrollingpolicy"> <filenamepattern>${log_archive}/bookingflow-%d{yyyy-mm-dd}.log</filenamepattern> <maxhistory>30</maxhistory> <totalsizecap>1gb</totalsizecap> </rollingpolicy> <encoder> <pattern>%d %-5level [%thread] %logger : %msg%n</pattern> </encoder> </appender> <appender name="async-appender" class="ch.qos.logback.classic.asyncappender"> <appender-ref ref="rollingfile-appender"/> </appender> <logger name="com.novasol.bookingflow.api" level="debug"> <appender-ref ref="async-appender"/> </logger> <springprofile name="production"> <logger name="com.novasol.bookingflow.api" level="error"> <appender-ref ref="async-appender"/> </logger> </springprofile> </configuration>
any pointers appreciated.
kind regards lars
solved in following manner:
in application.yml
logging: config: classpath: "logback-spring.xml" file: logs/bookingflow.log
the "logback-spring.xml":
<configuration debug="true" scan="true"> <include resource="org/springframework/boot/logging/logback/base.xml"/> <property name="log_archive" value="${log_path}/archive"/> <appender name="rollingfile-appender" class="ch.qos.logback.core.rolling.rollingfileappender"> <file>${log_path}/${log_file}</file> <rollingpolicy class="ch.qos.logback.core.rolling.timebasedrollingpolicy"> <filenamepattern>${log_archive}/bookingflow-%d{yyyy-mm-dd}.log</filenamepattern> <maxhistory>30</maxhistory> <totalsizecap>1gb</totalsizecap> </rollingpolicy> <encoder> <pattern>%d %-5level [%thread] %logger : %msg%n</pattern> </encoder> </appender> <appender name="async-appender" class="ch.qos.logback.classic.asyncappender"> <appender-ref ref="rollingfile-appender"/> </appender> <logger name="com.novasol.bookingflow.api" level="debug"> <appender-ref ref="async-appender"/> </logger> <springprofile name="production"> <logger name="com.novasol.bookingflow.api" level="error"> <appender-ref ref="async-appender"/> </logger> </springprofile>
finally found solution:
the following needs specified
endpoints: logfile: external-file: logs/custom.log
Comments
Post a Comment