You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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):
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:
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.
The text was updated successfully, but these errors were encountered:
spring.application.name=actuator-test
spring.application.instance_id=${random.value} # or ${random.uuid} or ${random.int}
management.endpoints.web.exposure.include=*
logging.file=./target/logs/${spring.application.name}/${spring.application.instance_id}.log
morth
changed the title
/actuator/logfile endpoint returning 404 when logging.file property contains a placeholder
/actuator/logfile endpoint returning 404 when logging.file property contains a random value
Jul 5, 2019
The reason for this is that the ${random.value} expression is re-evaluated every time that http://localhost:8080/actuator/logfile is called.
It's evaluated first on application startup (determining the logfile name on the file system). Every time the endpoint is accessed and tries to resolve the logfile name in LogFileWebEndpoint.getLogFileResource() a new random value is generated, thus the logfile cannot be found.
I'm running a Spring Boot 2.1.6.RELEASE application using
spring-boot-starter-actuator
to expose the application's logfile over HTTP. Myapplication.properties
looks as follows (runnable example here):When I run the application and call up
http://localhost:8080/actuator/logfile
I get a 404 error, even though the endpoint is listed inhttp://localhost:8080/actuator
: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 replacelogging.file=./target/logs/${spring.application.name}/${spring.application.instance_id}.log
with something likelogging.file=./target/logs/test.log
, everything works as expected.The text was updated successfully, but these errors were encountered: