This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-30
Channels
- # announcements (5)
- # beginners (90)
- # cider (15)
- # clara (1)
- # clj-kondo (2)
- # cljs-dev (17)
- # clojars (8)
- # clojure (132)
- # clojure-europe (14)
- # clojure-nl (5)
- # clojure-uk (57)
- # clojurescript (39)
- # code-reviews (44)
- # conjure (6)
- # core-async (6)
- # cursive (20)
- # data-science (1)
- # datomic (13)
- # fulcro (11)
- # graalvm (6)
- # graphql (6)
- # helix (10)
- # joker (2)
- # kaocha (37)
- # leiningen (24)
- # malli (15)
- # off-topic (13)
- # pathom (18)
- # pedestal (14)
- # re-frame (67)
- # reitit (5)
- # ring (13)
- # ring-swagger (4)
- # sci (41)
- # shadow-cljs (33)
- # slack-help (5)
- # spacemacs (1)
- # sql (34)
- # tools-deps (64)
- # vim (171)
- # xtdb (3)
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.
Uhm well logback only has access to the string content. It might be able to create a filter based on a regex.
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