View | Details | Raw Unified | Return to bug 14906
Collapse All | Expand All

(-)a/Koha/Logger.pm (-1 / +4 lines)
Lines 155-161 sub _check_conf { # check logfiles in log4perl config (at initialization) Link Here
155
        if ( $l =~ /(OPAC|INTRANET)\.filename\s*=\s*(.*)\s*$/i ) {
155
        if ( $l =~ /(OPAC|INTRANET)\.filename\s*=\s*(.*)\s*$/i ) {
156
156
157
            # we only check the two default logfiles, skipping additional ones
157
            # we only check the two default logfiles, skipping additional ones
158
            return if !-w $2;
158
            unless ( -w $2 ) {
159
                carp "Logger configuration error - Wrong permission for file $2";
160
                next;
161
            }
159
            push @logs, $1 . ':' . $2;
162
            push @logs, $1 . ':' . $2;
160
        }
163
        }
161
    }
164
    }
(-)a/t/Logger.t (-3 / +7 lines)
Lines 26-32 use Test::More tests => 1; Link Here
26
use Test::Warn;
26
use Test::Warn;
27
27
28
subtest 'Test01 -- Simple tests for Koha::Logger' => sub {
28
subtest 'Test01 -- Simple tests for Koha::Logger' => sub {
29
    plan tests => 8;
29
    plan tests => 9;
30
    test01();
30
    test01();
31
};
31
};
32
32
Lines 52-58 log4perl.appender.INTRANET.layout.ConversionPattern=[%d] [%p] %m %l %n Link Here
52
HERE
52
HERE
53
    );
53
    );
54
    $mContext->mock( 'config', sub { return $conf; } );
54
    $mContext->mock( 'config', sub { return $conf; } );
55
    $logger= Koha::Logger->get({ interface => 'intranet' });
55
    system("chmod 400 $log");
56
    warning_like { $logger = Koha::Logger->get({ interface => 'intranet' }) }
57
            qr/permission/, "Koha::Logger should raise a warning if there is a permission issue";
58
59
    system("chmod 600 $log");
60
    $logger = Koha::Logger->get({ interface => 'intranet' });
56
    is( exists $logger->{logger}, 1, 'Log4perl config found');
61
    is( exists $logger->{logger}, 1, 'Log4perl config found');
57
    is( $logger->warn('Message 2'), 1, 'Message 2 returned a value' );
62
    is( $logger->warn('Message 2'), 1, 'Message 2 returned a value' );
58
    warning_is { $ret = $logger->catastrophe }
63
    warning_is { $ret = $logger->catastrophe }
59
- 

Return to bug 14906