При запуске приложения SpringBoot 2.0.3
на tomcat 8.5.0
я получаю следующую ошибку:
ОШИБКА в ch.qos.logback.core.rolling.RollingFileAppender [FILE] -
openFile (C: \ Program Files \ Apache Software Foundation \ Tomcat)
9.0 \ temp / spring.log, true) вызов не удался. java.io.FileNotFoundException: C: \ Program Files \ Apache Software Foundation \ Tomcat 9.0 \ temp \ spring.log
(Доступ запрещен)
logback-spring.xml
из этого модуля выглядит следующим образом:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<springProperty scope="context" name="springAppName" source="spring.application.name"/>
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<include resource="logback-json.xml"/>
<property name="LOG_PATTERN"
value="%date{yyyy-MM-dd HH:mm:ss.SSS}|${springAppName}|[%X{X-B3-TraceId:-},%X{X-B3-SpanId:-},%X{X-Span-Export:-}]|%thread|%.-1level|%logger{10}|%msg%n"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<appender name="ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${catalina.base}/logs/${springAppName}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${catalina.base}/logs/${springAppName}-%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern>
<maxFileSize>200MB</maxFileSize>
</rollingPolicy>
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<logger name="pl.X" level="debug"/>
<logger name="jdbc.sqltiming" level="info"/>
<appender name="ASYNC_REQUEST_RESPONSE_JSON_LOG" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="REQUEST_RESPONSE_JSON_LOG"/>
</appender>
<appender name="ASYNC_ROLLING" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="ROLLING"/>
</appender>
<appender name="ASYNC_SERVER_JSON_LOG" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="SERVER_JSON_LOG"/>
</appender>
<logger name="somePakaes.trace.XLoggingFilter" additivity="false" level="DEBUG">
<appender-ref ref="ASYNC_REQUEST_RESPONSE_JSON_LOG"/>
</logger>
<root level="WARN">
<appender-ref ref="ASYNC_ROLLING"/>
<appender-ref ref="ASYNC_SERVER_JSON_LOG"/>
<appender-ref ref="CONSOLE"/>
</root>
А вот logback-json.xml
, к которому относятся вышеуказанные файлы:
<?xml version="1.0" encoding="UTF-8"?>
<included>
<springProperty scope="context" name="springAppName" source="spring.application.name"/>
<appender name="SERVER_JSON_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${catalina.base}/logs/${springAppName}.json</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${catalina.base}/logs/${springAppName}-%d{yyyy-MM-dd}.%i.json.zip</fileNamePattern>
<maxFileSize>200MB</maxFileSize>
<maxHistory>2</maxHistory>
</rollingPolicy>
<encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
<providers>
<pattern>
<pattern>
{
"date":"%date",
"severity": "%level",
"service": "${springAppName}",
"trace": "%X{X-B3-TraceId:-}",
"span": "%X{X-B3-SpanId:-}",
"parent": "%X{X-B3-ParentSpanId:-}",
"exportable": "%X{X-Span-Export:-}",
"pid": "${PID:-}",
"thread": "%thread",
"class": "%logger{26}",
"message": "%message",
"ex": "%ex"
}
</pattern>
</pattern>
</providers>
</encoder>
</appender>
<logger name="org.springframework.cloud.sleuth.instrument.web.TraceFilter" level="error"/>
<logger name="org.springframework.cloud.sleuth.instrument.web.TraceHandlerInterceptor" level="error"/>
<appender name="REQUEST_RESPONSE_JSON_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${catalina.base}/logs/${springAppName}_request_response.json</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${catalina.base}/logs/${springAppName}_request_response-%d{yyyy-MM-dd}.%i.json.zip</fileNamePattern>
<maxFileSize>200MB</maxFileSize>
<maxHistory>2</maxHistory>
</rollingPolicy>
<encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
<providers>
<pattern>
<pattern>
{
"date":"%date",
"service": "${springAppName}",
"severity": "%level",
"trace": "%X{X-B3-TraceId:-}",
"span": "%X{X-B3-SpanId:-}",
"parent": "%X{X-B3-ParentSpanId:-}",
"pid": "${PID:-}",
"thread": "%thread",
"message": "%message"
}
</pattern>
</pattern>
</providers>
</encoder>
</appender>
</included>
Но проблема исчезает при запуске InteliJ как admin
.