java Spring Boot 中的日志文件端点
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33938997/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
logfile endpoint in Spring Boot
提问by ps-aux
I read Spring Boot Actuator documentationand saw logfile
endpoint mentioned there which would really come in handy.
我阅读了 Spring Boot Actuator文档并看到了logfile
那里提到的端点,这真的会派上用场。
However this endpoint is not registered in my app and I have no idea how to make it available. What is needed here?
但是,此端点未在我的应用程序中注册,我不知道如何使其可用。这里需要什么?
采纳答案by lekant
/logfile was included in version 1.3.0 only
/logfile 仅包含在 1.3.0 版中
If you use an earlier version it will then not be present..
如果您使用较早的版本,则它将不存在。
回答by Gergely Bacso
In order to enable this feature, one of these two params need to be set:
为了启用此功能,需要设置以下两个参数之一:
logging.file
logging.path
logging.file
logging.path
After that the endpoint should be enabled by default.
之后,端点应默认启用。
回答by Jan69
I added below code to enable /logfile endpoint
我添加了以下代码以启用 /logfile 端点
pom.xml
-----------
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
application.properties
-----------------------
management.security.enabled=false
endpoints.env.enabled=false
endpoints.configprops.enabled=false
endpoints.autoconfig.enabled=false
endpoints.beans.enabled=false
endpoints.dump.enabled=true
endpoints.heapdump.enabled=true
logging.level.root=info
logging.file=target/app.log
回答by Allahbaksh Asadullah
I had below lines in my application.properties . I am using spring-boot with actuator
我的 application.properties 中有以下几行。我正在使用带有执行器的弹簧靴
logging.file.name=./logs/log-file.log
management.endpoints.web.exposure.include=*
Without the management extension line, the response was
Without the management extension line, the response was
Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback.
Wed Dec 04 05:04:40 IST 2019 There was an unexpected error (type=Not Found, status=404). No message available
回答by user3283865
I had used below for
I had used below for
version 2.1.3 -> management.endpoint.logfile=C:/apps/Benefits-logs/adapt-rest.log as you can see class LogFileWebEndpointProperties
version 2.1.3 -> management.endpoint.logfile=C:/apps/Benefits-logs/adapt-rest.log as you can see class LogFileWebEndpointProperties
and this also works logging.file=C:/apps/Benefits-logs/adapt-rest.log
and this also works logging.file=C:/apps/Benefits-logs/adapt-rest.log
No need to add logging.path. If you see LogFileCondition class you will get to know.
No need to add logging.path. If you see LogFileCondition class you will get to know.