如何用springboot和cloud foundry禁用tomcat访问日志

How to disable tomcat access logs with springboot and cloud foundry

[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

以上是我使用的spring版本

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 中吗?

顺便说一句,这不是 logback 日志记录,因为它们看起来像这样

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

您看到的日志是路由器在将 HTTP 请求路由到应用程序时发出的。有关详细信息,请参阅 here

不知道有没有办法禁用路由器日志,不过你可以过滤掉:

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