[Bug 28477] New: INTRANET and OPAC loggers should print to STDERR instead of to file
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28477 Bug ID: 28477 Summary: INTRANET and OPAC loggers should print to STDERR instead of to file Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: minor Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: dcook@prosentient.com.au QA Contact: testopia@bugs.koha-community.org Bug 25284 notes that Plack will fail to start up if the /var/log/koha/<site>/opac-error.log file isn't writeable by the specific Koha Linux user. It has a workaround for chowning all the log files, but that's really not the best way to go. We shouldn't be messing around with the log files that belong to the Apache web server. Instead, we should be printing to STDERR using the Log4Perl logger. For CGI Koha using Apache, that text will wind up in the correct web server log file automatically. For Plack Koha, it would wind up the correct web server log file as well... or thanks to Bug 16357 they'll wind up special log files created and owned by Koha. It's as easy as changing the Log4Perl configuration as follows: FROM: log4perl.appender.INTRANET=Log::Log4perl::Appender::File log4perl.appender.INTRANET.filename=__LOG_DIR__/intranet-error.log log4perl.appender.OPAC=Log::Log4perl::Appender::File log4perl.appender.OPAC.filename=__LOG_DIR__/opac-error.log TO: log4perl.appender.INTRANET=Log::Log4perl::Appender::Screen log4perl.appender.INTRANET.stderr = 1 log4perl.appender.OPAC=Log::Log4perl::Appender::Screen log4perl.appender.OPAC.stderr = 1 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28477 --- Comment #1 from David Cook <dcook@prosentient.com.au> --- The logger is a bit of a pain to test though, so not sure how much energy I actually have to devote to testing this change... -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28477 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28477 --- Comment #2 from David Cook <dcook@prosentient.com.au> --- Created attachment 121466 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=121466&action=edit Bug 28477: Change INTRANET and OPAC logs to use STDERR rather than file This patch changes the default Log4Perl config to use STDERR instead of the Apache log files for the INTRANET and OPAC loggers. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28477 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |dcook@prosentient.com.au |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28477 --- Comment #3 from David Cook <dcook@prosentient.com.au> --- Created attachment 121467 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=121467&action=edit Bug 28477: Add unit test to prove logging to STDERR works This patch shows that using the Screen/Stderr=1 Log4perl configuration with Koha::Logger will output to STDERR. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28477 --- Comment #4 from David Cook <dcook@prosentient.com.au> --- Note that the first test in t/Logger.t was already broken, and looks like a pain to test due to Log::Log4perl being a singleton... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28477 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |In Discussion --- Comment #5 from David Cook <dcook@prosentient.com.au> --- If folk have tests for the actual intranet and opac scripts, that would be great. I can't be bothered trying to work those out right now. -- Although the more I think about it... While this should work fine with Apache, it might not work as one might expect with Plack in regards to Bug 16357. Bug 16357 overwrites SIGWARN, but Log::Log4perl isn't using SIGWARN. It's printing to STDERR. So the errors would wind up in plack-error.log (rather than plack-intranet-error.log or plack-opac-error.log). That's not great because the logs aren't separated... -- Maybe we shouldn't have called the error files plack-opac-error.log and plack-intranet-error.log and instead just called them koha-opac-error.log and koha-intranet-error.log and set both appenders to logging to the same file... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28477 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=25284 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28477 Andrew Nugged <nugged@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nugged@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28477 --- Comment #6 from Andrew Nugged <nugged@gmail.com> --- Sidenote: we also have pack-error.log without timestamps, which makes backtrace and debugging of important dies very hard on productions. Do we have anything on that? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28477 --- Comment #7 from David Cook <dcook@prosentient.com.au> --- (In reply to Andrew Nugged from comment #6)
Sidenote: we also have pack-error.log without timestamps, which makes backtrace and debugging of important dies very hard on productions. Do we have anything on that?
Bug 16357 should resolve that issue. Looks like it's available from 20.11+ and backported to 20.05.05. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28477 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|dcook@prosentient.com.au |koha-bugs@lists.koha-commun | |ity.org -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28477 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|In Discussion |RESOLVED --- Comment #8 from David Cook <dcook@prosentient.com.au> --- Koha has changed its Plack logging since this was reported -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org