Skip to content

Log all new requests at info level

Maxime Besson requested to merge improve-log-info into v2.0

If you set your logLevel to "info", currently your LLNG logs look like this:

[info] No cookie found
[info] No cookie found
[info] No cookie found

which is not very useful

Additionally, when you run your logs at "debug" level it's very hard to know when a new request starts or stops

[debug] Start routing psgi.js
# new request starts here!::
[debug] Check configuration for Lemonldap::NG::Handler::PSGI::Main

This MR makes LLNG logs much clearer by indicating when a new request starts. Here is a handler => portal => authentication => handler scenario, which I think is a big improvement:

[info] New request Lemonldap::NG::Handler::Server::Nginx GET /
[info] New request Lemonldap::NG::Portal::Main GET /?url=aHR0cHM6Ly90ZXN0MS5sZW1vbnRlc3QubHhkLw%3D%3D
[info] New request Lemonldap::NG::Portal::Main POST /?url=aHR0cHM6Ly90ZXN0MS5sZW1vbnRlc3QubHhkLw%3D%3D
[notice] User dwho successfully authenticated at level 2
[info] No notification found
[notice] dwho connected
[info] New request Lemonldap::NG::Handler::Server::Nginx GET /?lemonldapcda=f0e4329d91782a0c27564812904fbf9debc722eed3272e14fb6cc110967da04a
[info] New request Lemonldap::NG::Handler::Server::Nginx GET /
[info] New request Lemonldap::NG::Handler::Server::Nginx GET /favicon.ico

I have also moves the "no cookie" message to "debug" level because I don't think it's very relevant. In order to implement this, I moved all Lemonldap::NG::Common::PSGI::Request creations into a dedicated "factory" function.

@guimard @maudoux what to you think of this proposal ? Is it OK to log all requests at "info" level or should I move it to debug ? Do I need to make any changes to the log format ?

Edited by Maxime Besson

Merge request reports

Loading