Bug 25524 - Debian packages always append to /etc/koha/sites/$site/log4perl.conf
Summary: Debian packages always append to /etc/koha/sites/$site/log4perl.conf
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Packaging (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: David Cook
QA Contact: Tomás Cohen Arazi
URL:
Keywords:
Depends on: 24905 25510
Blocks: 25529
  Show dependency treegraph
 
Reported: 2020-05-18 06:58 UTC by David Cook
Modified: 2020-05-21 00:03 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:
20.05.00, 19.11.06


Attachments
Bug 25524: Remove --line-regexp option in log4perl_component() (1.63 KB, patch)
2020-05-18 07:14 UTC, David Cook
Details | Diff | Splinter Review
Bug 25524: Remove --line-regexp option in log4perl_component() (1.69 KB, patch)
2020-05-19 20:45 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 25524: Remove --line-regexp option in log4perl_component() (1.74 KB, patch)
2020-05-19 22:24 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Cook 2020-05-18 06:58:05 UTC
Bug 24905 created a way to automatically append config to /etc/koha/sites/$site/log4perl.conf

However, the "grep" isn't correct, so the config gets appended whether or not the logger already exists in the log4perl.conf file.
Comment 1 David Cook 2020-05-18 07:14:33 UTC
Created attachment 105006 [details] [review]
Bug 25524: Remove --line-regexp option in log4perl_component()

The current grep expression uses -x|--line-regexp, but that causes
the regexp to fail to match since we're not specifying a regexp
that can match a whole line. We can either provide a better regexp,
or remove that --line-regexp option.

This patch removes the --line-regexp (ie -x) option from the grep
in log4perl_component, so that it detects logger components correctly.

To Test:
0) Apply patch
1) Build Koha package
2) Look at /etc/koha/sites/kohadev/log4perl.conf in an existing
Koha instance (e.g. on koha-testing-docker), and note it has
components for z3950, api, and sip
3) Install package
4) Note that /etc/koha/sites/kohadev/log4perl.conf is the same as before
5) Remove the "log4perl.logger.sip and log4perl.appender.SIP lines from
/etc/koha/sites/kohadev/log4perl.conf
6) Reinstall package
7) Note that the missing lines have been appended to the file at
/etc/koha/sites/kohadev/log4perl.conf
Comment 2 David Cook 2020-05-18 07:23:55 UTC
Actually, this might only be an issue, if/when Bug 25510 is fixed.
Comment 3 Tomás Cohen Arazi 2020-05-19 12:37:47 UTC
Good catch!

19.11 mantainer: this should be pushed at the same time we push 25510.
Comment 4 Chris Cormack 2020-05-19 20:45:37 UTC
Created attachment 105123 [details] [review]
Bug 25524: Remove --line-regexp option in log4perl_component()

The current grep expression uses -x|--line-regexp, but that causes
the regexp to fail to match since we're not specifying a regexp
that can match a whole line. We can either provide a better regexp,
or remove that --line-regexp option.

This patch removes the --line-regexp (ie -x) option from the grep
in log4perl_component, so that it detects logger components correctly.

To Test:
0) Apply patch
1) Build Koha package
2) Look at /etc/koha/sites/kohadev/log4perl.conf in an existing
Koha instance (e.g. on koha-testing-docker), and note it has
components for z3950, api, and sip
3) Install package
4) Note that /etc/koha/sites/kohadev/log4perl.conf is the same as before
5) Remove the "log4perl.logger.sip and log4perl.appender.SIP lines from
/etc/koha/sites/kohadev/log4perl.conf
6) Reinstall package
7) Note that the missing lines have been appended to the file at
/etc/koha/sites/kohadev/log4perl.conf

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Comment 5 Tomás Cohen Arazi 2020-05-19 22:24:31 UTC
Created attachment 105125 [details] [review]
Bug 25524: Remove --line-regexp option in log4perl_component()

The current grep expression uses -x|--line-regexp, but that causes
the regexp to fail to match since we're not specifying a regexp
that can match a whole line. We can either provide a better regexp,
or remove that --line-regexp option.

This patch removes the --line-regexp (ie -x) option from the grep
in log4perl_component, so that it detects logger components correctly.

To Test:
0) Apply patch
1) Build Koha package
2) Look at /etc/koha/sites/kohadev/log4perl.conf in an existing
Koha instance (e.g. on koha-testing-docker), and note it has
components for z3950, api, and sip
3) Install package
4) Note that /etc/koha/sites/kohadev/log4perl.conf is the same as before
5) Remove the "log4perl.logger.sip and log4perl.appender.SIP lines from
/etc/koha/sites/kohadev/log4perl.conf
6) Reinstall package
7) Note that the missing lines have been appended to the file at
/etc/koha/sites/kohadev/log4perl.conf

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 6 Martin Renvoize 2020-05-20 08:18:36 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 7 Joy Nelson 2020-05-20 22:44:29 UTC
backported to 19.11.x for 19.11.06
Comment 8 Tomás Cohen Arazi 2020-05-21 00:03:59 UTC
(In reply to Joy Nelson from comment #7)
> backported to 19.11.x for 19.11.06

\o/