如何使用Springboot和Cloud Foundry禁用tomcat访问日志

时间:2018-10-12 17:07:12

标签: spring-boot tomcat cloudfoundry

[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.0.3.RELEASE:compile
[INFO] | +- org.hibernate.validator:hibernate-validator:jar:6.0.10.Final:compile
[INFO] | | \- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] | +- org.springframework:spring-web:jar:5.0.7.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:5.0.7.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.0.3.RELEASE:provided
[INFO] | +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.31:provided
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.31:provided
[INFO] | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.31:provided

以上是我正在使用的春季版本

2018-10-12T11:19:34.78-0500 [RTR/1] OUT
2018-10-12T11:19:34.80-0500 [RTR/1] OUT myapp-dev.apps.pcf.company.com ...
[2018-10-12T16:19:34.778+0000] "OPTIONS /cloudfoundryapplication/mappings HTTP/1.1" 200 0 0 "-" ...
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36" "10.126.5.247:49163" "10.212.58.166:61054" x_forwarded_for:"10.45.137.38, 10.126.5.247" x_forwarded_proto:"https" vcap_request_id:"24d40ced-4982-41dd-559d-3fbde7165eb1" response_time:0.016173018 app_id:"b26f4acb-b78c-4d9f-909c-de4edec9725b" app_index:"0" x_b3_traceid:"c328e8e59f70beb7" x_b3_spanid:"c328e8e59f70beb7" x_b3_parentspanid:"-"

是什么记录器记录此请求?

是否有任何方法可以忽略此请求以将其记录在pcf中?

这不是回溯日志记录,因为它们看起来像这样

2018-10-12T12:23:25.08-0500 [APP/PROC/WEB/0] OUT vehicle360 12-10-2018 17:23:25.087 ... 
[http-nio-8080-exec-7] INFO  com.mycompany.vehicle360.logging.LoggingAspect.logExecutionTime:21 - VehicleDTO com.mycompany.vehicle360.service.Vehicle360GDAASService.getVinDetails(String,String,String) executed in 1398ms

1 个答案:

答案 0 :(得分:2)

路由器将HTTP请求路由到应用程序时,您将看到您看到的日志。有关更多信息,请参见here

我不知道是否有禁用路由器日志的方法,但是您可以将其过滤掉:

$ cf logs APP-NAME --recent | grep -v RTR