pedestal

Ivar Refsdal 2020-06-30T08:50:21.293400Z

Hi again @souenzzo If you are interested the following code solved the use case: https://github.com/pedestal/pedestal/issues/665#issuecomment-651652532 It's not perfect, but it works.

erwinrooijakkers 2020-06-30T11:22:08.294400Z

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

erwinrooijakkers 2020-06-30T11:22:27.294900Z

Is there a way to modify the logger in such a way that requests to “\/” are ignored?

souenzzo 2020-06-30T13:04:59.295400Z

I think that we are a bit confused about async and lazy things If you are sending a huge payload, your client probably will not handle it "as a json array", it will prefer "a steam of jsons"

Joe Lane 2020-06-30T13:36:29.296200Z

@erwinrooijakkers change your logback.xml file to change the log level that is reported to be above "INFO"

erwinrooijakkers 2020-06-30T13:47:23.296500Z

The thing is I do want other INFO logging

erwinrooijakkers 2020-06-30T13:47:28.296800Z

Other requests are fine

erwinrooijakkers 2020-06-30T13:47:37.297200Z

Only not GET requests to /

erwinrooijakkers 2020-06-30T13:48:08.297600Z

I think it can be done by modifying the request-logger

erwinrooijakkers 2020-06-30T13:48:53.297800Z

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)))

erwinrooijakkers 2020-06-30T13:49:06.298200Z

So I can change that one to check the :uri and then not log. 🙂

Ivar Refsdal 2020-07-02T09:11:56.301400Z

That's seems fine I think

Ivar Refsdal 2020-07-02T09:13:01.301600Z

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 case

Joe Lane 2020-06-30T14:04:54.299600Z

I 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.

2020-06-30T14:11:27.300800Z

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

erwinrooijakkers 2020-06-30T16:46:06.301Z

Uhm well logback only has access to the string content. It might be able to create a filter based on a regex.