Enable client logtrace with environment vars
authorBill Erickson <berick@esilibrary.com>
Wed, 17 Oct 2012 18:31:02 +0000 (14:31 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Wed, 6 Feb 2013 20:09:45 +0000 (15:09 -0500)
Supports a new environment variable OSRF_LOG_CLIENT which, if true,
enables control and generation of the client log trace value.  This is
the same as setting <client>true</client> within the opensrf core
configuration file.

As a shortcut, if the MOD_PERL environment variable is set, assume
client=true.

This allows clients and non-clients to share an opensrf core
configuration file, when previously the only difference between the two
was the <client> setting.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
src/perl/lib/OpenSRF/Utils/Logger.pm

index 2a450ae..be13ecd 100644 (file)
@@ -109,6 +109,12 @@ sub set_config {
     }
 
        my $client = OpenSRF::Utils::Config->current->bootstrap->client();
+
+       if ($ENV{OSRF_LOG_CLIENT} or $ENV{MOD_PERL}) {
+               $isclient = 1;
+               return;
+       }
+
        if (!$client) {
                $isclient = 0;
                return;