Description
I'm running a Spring Boot 2.1.6.RELEASE application using spring-boot-starter-actuator
to expose the application's logfile over HTTP. My application.properties
looks as follows (runnable example here):
spring.application.name=actuator-test
spring.application.instance_id=${random.value}
management.endpoints.web.exposure.include=*
logging.file=./target/logs/${spring.application.name}/${spring.application.instance_id}.log
When I run the application and call up http://localhost:8080/actuator/logfile
I get a 404 error, even though the endpoint is listed in http://localhost:8080/actuator
:
{
"_links": {
"self": {
"href": "http://localhost:8080/actuator",
"templated": false
},
...
"logfile": {
"href": "http://localhost:8080/actuator/logfile",
"templated": false
},
...
}
}
The logfile itself is successfully generated and stored in the expected path.
I've found out that this has something to do with the use of placeholders in the logging.file
property definition. As soon as I replace logging.file=./target/logs/${spring.application.name}/${spring.application.instance_id}.log
with something like logging.file=./target/logs/test.log
, everything works as expected.