]> git.evergreen-ils.org Git - working/OpenSRF.git/commit
Change potentially slow log statements to subroutines user/jmerriam/slow_logging_use_subs
authorJohn Merriam <jmerriam@biblio.org>
Wed, 10 Apr 2019 15:06:14 +0000 (11:06 -0400)
committerJohn Merriam <jmerriam@biblio.org>
Wed, 10 Apr 2019 15:06:14 +0000 (11:06 -0400)
commit56e23c1cc859259c39b22a6485a80abc702cc78b
treea8b571734f9b71777a040fad34529b4bf9e4e198
parent0a00bcc9182571eef3af2b14c503e01dbd066ea3
Change potentially slow log statements to subroutines

*** This branch depends on user/jmerriam/allow_log_subs ***

The OpenSRF code was searched for potentially slow logging statements at
log level info or above. We then changed those logging statements to be
delayed execution subroutines. This is in reaction to LP1823338 where a
slow debug logging statement was slowing down SIP checkins even though
debug logging was not turned on.

Here is some pseudocode that shows what is being done here:

$log->debug("Some text " . $some->slow_method);

would be changed to:

$log->debug(sub{return "Some text " . $some->slow_method });

With this change, an unnamed sub is passed to the OpenSRF logger module
and it will not be executed unless the global logging level is set to
debug or higher (the slow_method will not be called unless it is needed
for that logging level).

********
If/when this is committed, please use delayed execution subroutines for
any logging statements that could be slow in the future. It is recommend
that any logging statements that do not consist entirely of quoted text
and/or already available scalar variables use delayed execution
subroutines.
********

Signed-off-by: John Merriam <jmerriam@biblio.org>
src/perl/lib/OpenSRF/AppSession.pm
src/perl/lib/OpenSRF/Application.pm
src/perl/lib/OpenSRF/DomainObject/oilsMessage.pm
src/perl/lib/OpenSRF/EX.pm
src/perl/lib/OpenSRF/MultiSession.pm
src/perl/lib/OpenSRF/Server.pm
src/perl/lib/OpenSRF/Transport.pm
src/perl/lib/OpenSRF/Transport/SlimJabber/Client.pm