I’ve noticed that after deploying a small yesod that each request is being logged to output. I’ve tried searching for a setting to disable this but I cannot find anything. Does anyone know how to disable this?
Edit: I did not use the scaffold to create the app.
I don’t exactly know where the per-request loging is, but the loging settings or at least part of them are set in Foundation.hs (assuming you use the scaffolding code). Maybe this helps.
I think there is probably some logging happening by default. Yesod is typically used together with warp which serves as the actual HTTP server running your Yesod application.
By using warp’s runSettings rather than run you should be able to pass in additional settings, including logging settings. This should probably go in tour main function somewhere. Hope this helps!
@wiz I’ve been useing the guide from the yesod book here. If you go to the section I/O and debugging, you can see that the shouldLogIO is overridden to return True. I’ve overridden that to return False this turned of the initial log output when you start the application but each request is still being logged to the console.
@jaspervdj thanks for the suggestion. I checked out the defaultSettings funciton that should be ran when you use the run command vs the runSettings command.
Huh. I’ve checked out shouldLogIO method and it indeed does not have access to a http request. It appears that it is for site-specific log messages that could be toggled while the site is running.
Default logging middleware may have no hooks to filter requests. I think you can use replace default middleware set with your own, where its logging middleware is wrapped in your filter function. Middleware is just a function that gets request and you can make a choice to invoke request logging or skip it.
Putting on my necromancer hat and raising this topic from the dead…
@decapo01, did you eventually find an answer to this question? I myself and looking to not so much disable per request logging than tweak it a bit. I am using scaffolding.