[Koha-bugs] [Bug 16357] Plack error logs are not time stamped

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Aug 30 21:25:56 CEST 2019


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16357

--- Comment #41 from Liz Rea <wizzyrea at gmail.com> ---
Ok, I've made this work again, and I followed my previous notes to get there
with the addition of one detail

by default, the log perms look like this: 

vagrant at kohadevbox:kohadev$ ls -lah
total 688K
drwxr-xr-x 2 kohadev-koha kohadev-koha 4.0K Aug 30 14:50 .
drwxr-xr-x 3 root         root         4.0K Aug 30 14:47 ..
-rw-r--r-- 1 kohadev-koha kohadev-koha  25K Aug 30 18:36 indexer-error.log
-rw-r--r-- 1 kohadev-koha kohadev-koha    0 Aug 30 14:47 indexer-output.log
-rw-r--r-- 1 root         root            0 Aug 30 14:47 intranet-error.log
-rw-r--r-- 1 root         root         105K Aug 30 14:49 opac-error.log
-rw-r--r-- 1 kohadev-koha kohadev-koha 524K Aug 30 18:36 plack-error.log
-rw-r--r-- 1 kohadev-koha kohadev-koha 6.8K Aug 30 18:36 plack.log
-rw-r--r-- 1 kohadev-koha kohadev-koha  773 Aug 30 18:36 zebra-error.log
-rw-r--r-- 1 kohadev-koha kohadev-koha  399 Aug 30 18:36 zebra-output.log


If you apply this patch, and restart plack and try for an error:

"Log4perl: Seems like no initialization happened. Forgot to call init()?"

Ok that's not great. So look at Koha::Logger - in

119 sub _init {
120     my $rv;
121     if ( exists $ENV{"LOG4PERL_CONF"} and $ENV{'LOG4PERL_CONF'} and -s
$ENV{"LOG4PERL_CONF"} ) {
122 
123         # Check for web server level configuration first
124         # In this case we ASSUME that you correctly arranged logfile
125         # permissions. If not, log4perl will crash on you.
126         # We will not parse apache files here.
127         Log::Log4perl->init_once( $ENV{"LOG4PERL_CONF"} );
128     }
129     elsif ( C4::Context->config("log4perl_conf") ) {
130 
131         # Now look in the koha conf file. We only check the permissions of
132         # the default logfiles. For the rest, we again ASSUME that
133         # you arranged file permissions.
134         my $conf = C4::Context->config("log4perl_conf");
135         if ( $rv = _check_conf($conf) ) {
136             Log::Log4perl->init_once($conf);
137             return $rv;
138         }
139         else {
140             return 0;
141         }
142     }
143     else {
144         # This means that you do not use log4perl currently.
145         # We will not be forcing it.
146         return 0;
147     }
148         warn "Log4Perl did not crash";
149 
150     return 1;    # if we make it here, log4perl did not crash :)
151 }

I didn't have any environment variables set in my devbox, so we're looking at
the path from koha-conf.xml.

So we assume "you arranged the file permissions" and something about this
doesn't sit right with me, and probably explains what is happening here.

Anyway, with this patch installed the default way I've done for testing,
apparently _check_conf fails - probably bc koha-kohadev can't write the apache
initialized logs. With the permissions set for owner koha-kohadev:koha-kohadev,
the patch works. 

When the log files are initialized, there are some that are set by Apache
(opac-access/error, intranet-access/error) and plack, which is initialized by
Koha. The plack one is owned by the instance, the apache ones are owned by
root. Logrotate will set these permissions back at rotate time.

Does somebody out there know more than me about logrotate and apache, to help
get these permissions doing the right thing? This patch is really necessary
(splitting is nice and stuff, but timestamps alone would be super ace).

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list