Kalpesh Soni
Kalpesh Soni

Reputation: 7257

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

That above is the spring version I am using

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:"-"

What logger is it that logs this request?

Is there any way to ignore this request from being logged in pcf?

By the way this is not logback logging because those look like this

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

Upvotes: 0

Views: 1020

Answers (1)

Boris
Boris

Reputation: 24443

The logs you see are emitted by the router when it routes HTTP requests to the app. See here for more info.

I don't know if there is a way to disable the router logs, but you can filter it out:

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

Upvotes: 2

Related Questions