我希望管理员可以使用我的日志文件,而无需 ssh
到主机。
希望像 http://myhost:myport/logs/app.log
这样简单。
有没有办法使用 Spring Boot 公开一个端点来为我的日志文件提供服务?
最佳答案
Spring Boot Actuator
将以下依赖项添加到您的应用程序:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
开箱即用,您将获得许多有用的端点,包括:/logfile
无需额外配置。
关于spring-boot - 从 Spring Boot 的嵌入式 Tomcat 提供日志文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38657861/