Конечная точка файла журнала SpringBoot Actuator возвращает 404

Вызов GET /actuator/logfile возвращает ошибку 404.

Как я могу получить журнал через привод/файл журнала?

$ curl -XGET localhost:8001/actuator/logfile -i
HTTP/1.1 404 
Content-Length: 0
Date: Tue, 22 Sep 2020 08:43:44 GMT

У меня есть конфигурация ниже.

Я запустил приложение с «локальным» профилем.

У меня есть файл журнала в папке журнала (например, api_log.2020-09-22-0.log).

приложение.yml

management:
  endpoints:
    web:
      exposure:
        include: "*"

  endpoint:
    health:
      show-details: always

logging:
  file:
    path: log

logback-spring.xml

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <include resource="log/console.xml"/>
    <include resource="log/file.xml"/>
    <root level="info">
        <springProfile name="dev">
            <appender-ref ref="dailyRollingFileAppender"/>
        </springProfile>
        <springProfile name="local">
            <appender-ref ref="dailyRollingFileAppender"/>
        </springProfile>
    </root>
</configuration>

журнал/файл.xml

<?xml version="1.0" encoding="UTF-8"?>
<appender name="dailyRollingFileAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <fileNamePattern>${LOG_PATH}/api_log.%d{yyyy-MM-dd}-%i.log</fileNamePattern>
        <maxHistory>10</maxHistory>
        <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
            <maxFileSize>100MB</maxFileSize>
        </timeBasedFileNamingAndTriggeringPolicy>
    </rollingPolicy>
    <encoder class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>

Конечная точка /actuator/logfile включает.

curl -XGET localhost:8001/actuator           
{
    "_links": {
        "self": {
            "href": "http://localhost:8001/actuator",
            "templated": false
        },
        "beans": {
            "href": "http://localhost:8001/actuator/beans",
            "templated": false
        },
        "caches": {
            "href": "http://localhost:8001/actuator/caches",
            "templated": false
        },
        "caches-cache": {
            "href": "http://localhost:8001/actuator/caches/{cache}",
            "templated": true
        },
        "health-path": {
            "href": "http://localhost:8001/actuator/health/{*path}",
            "templated": true
        },
        "health": {
            "href": "http://localhost:8001/actuator/health",
            "templated": false
        },
        "info": {
            "href": "http://localhost:8001/actuator/info",
            "templated": false
        },
        "conditions": {
            "href": "http://localhost:8001/actuator/conditions",
            "templated": false
        },
        "configprops": {
            "href": "http://localhost:8001/actuator/configprops",
            "templated": false
        },
        "env-toMatch": {
            "href": "http://localhost:8001/actuator/env/{toMatch}",
            "templated": true
        },
        "env": {
            "href": "http://localhost:8001/actuator/env",
            "templated": false
        },
        "logfile": {
            "href": "http://localhost:8001/actuator/logfile",
            "templated": false
        },
        "loggers-name": {
            "href": "http://localhost:8001/actuator/loggers/{name}",
            "templated": true
        },
        "loggers": {
            "href": "http://localhost:8001/actuator/loggers",
            "templated": false
        },
        "heapdump": {
            "href": "http://localhost:8001/actuator/heapdump",
            "templated": false
        },
        "threaddump": {
            "href": "http://localhost:8001/actuator/threaddump",
            "templated": false
        },
        "metrics": {
            "href": "http://localhost:8001/actuator/metrics",
            "templated": false
        },
        "metrics-requiredMetricName": {
            "href": "http://localhost:8001/actuator/metrics/{requiredMetricName}",
            "templated": true
        },
        "scheduledtasks": {
            "href": "http://localhost:8001/actuator/scheduledtasks",
            "templated": false
        },
        "mappings": {
            "href": "http://localhost:8001/actuator/mappings",
            "templated": false
        }
    }
}

person Charlie Shin    schedule 22.09.2020    source источник


Ответы (1)


Обновить application.yml

logging:
  file:
    path: log

to

logging:
  path: log
person Issac Whang    schedule 11.12.2020
comment
Это не дает ответа на вопрос. Получив достаточную репутацию, вы сможете /comment">прокомментировать любой пост; вместо этого дайте ответы которые не требуют разъяснений от спрашивающего. – Из обзора - person mjaggard; 11.12.2020