Hi because of a health check I see every second logging like this:
{"message":"{:msg \"GET /\", :line 80}","severity":"INFO","thread":"qtp1569164069-15","logger":"io.pedestal.http"}
Is there a way to modify the logger in such a way that requests to “\/” are ignored?
@erwinrooijakkers change your logback.xml
file to change the log level that is reported to be above "INFO"
The thing is I do want other INFO logging
Other requests are fine
Only not GET requests to /
I think it can be done by modifying the request-logger
Default is this:
(def log-request
"Log the request's method and uri."
(interceptor/on-request
::log-request
(fn [request]
(log/info :msg (format "%s %s"
(string/upper-case (name (:request-method request)))
(:uri request)))
(log/meter ::request)
request)))
So I can change that one to check the :uri and then not log. 🙂
That's seems fine I think
On my service-map I'm doing pretty much exactly that:
; [io.pedestal.http :as http]
(assoc ::http/request-logger weblog/log-request)
and
(def log-request
"Log the request's method and uri."
(helpers/on-request
::log-request
(fn [request]
(when (not= "/graphql-ws" (:uri request))
(ped-log/info :msg (format "%s %s"
(str/upper-case (name (:request-method request)))
(:uri request)))
(ped-log/meter ::request))
request)))
Pretty similar to your caseI really think you should make that change in the logback.xml
, but I don't know the details off the top of my head. This sounds like it should be a configuration change though, not a code change.
you could decorate the default request-logger and then pass yours in when you create the service https://github.com/pedestal/pedestal/blob/master/service/src/io/pedestal/http.clj#L205
Uhm well logback only has access to the string content. It might be able to create a filter based on a regex.