[Bug 28572] New: Replace C4::Debug with Koha::Logger->debug
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Bug ID: 28572 Summary: Replace C4::Debug with Koha::Logger->debug Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: In Discussion Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: jonathan.druart+koha@gmail.com Reporter: jonathan.druart+koha@gmail.com QA Contact: testopia@bugs.koha-community.org Should not we replace C4::Debug (and all "$debug && warn" statements) with Koha::Logger->debug? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle@bywatersolutions.com, | |m.de.rooy@rijksmuseum.nl, | |martin.renvoize@ptfs-europe | |.com, | |nick@bywatersolutions.com, | |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 --- Comment #1 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Great idea. Probably we could miss a lot of such statements too. Remove instead of replace where appropriate? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 --- Comment #2 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- +1, I love this idea -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 --- Comment #3 from Kyle M Hall <kyle@bywatersolutions.com> --- (In reply to Jonathan Druart from comment #0)
Should not we replace C4::Debug (and all "$debug && warn" statements) with Koha::Logger->debug?
+1 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 --- Comment #4 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Jonathan Druart from comment #0)
Should not we replace C4::Debug (and all "$debug && warn" statements) with Koha::Logger->debug?
+1 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|In Discussion |ASSIGNED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |28591, 28570 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28570 [Bug 28570] bor_issues_top.pl using a /tmp file to log debug https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28591 [Bug 28591] debug pass to get_template_and_user but not used -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 --- Comment #5 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 122118 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=122118&action=edit Bug 28572: Remove C4::Debug We are using Koha::Logger when it makes sense to keep the info, otherwise we simply remove it -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rel_21_11_candidate -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #122118|0 |1 is obsolete| | --- Comment #6 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 122147 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=122147&action=edit Bug 28572: Remove C4::Debug We are using Koha::Logger when it makes sense to keep the info, otherwise we simply remove it Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off --- Comment #7 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Great work.. signing off. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 --- Comment #8 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- No regressions found.. I went through the patches inspecting what had been removed/replaced and I agree with all the decisions Jonathan made.. be great to get a second opinion from QA, but I don't think there's anything controversial here.. it'll be great to see this go and hopefully it'll encourage a little more use of Koha::Logger by hiding dropping this alternative.. would be great to see more of the bare warns updated too at some point. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #9 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Just mentioning one compile error: perl -c tools/viewlog.pl Global symbol "$debug" requires explicit package name (did you forget to declare "my $debug"?) at /usr/share/koha/C4/Context.pm line 788. BEGIN not safe after errors--compilation aborted at /usr/share/koha/C4/Context.pm line 853. Compilation failed in require at /usr/share/koha/C4/Auth.pm line 30. BEGIN failed--compilation aborted at /usr/share/koha/C4/Auth.pm line 30. Compilation failed in require at tools/viewlog.pl line 23. BEGIN failed--compilation aborted at tools/viewlog.pl line 23. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 --- Comment #10 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- sub get_shelves_userenv { my $active; unless ($active = $context->{userenv}->{$context->{activeuser}}) { $debug and warn "get_shelves_userenv cannot retrieve context->{userenv}->{context->{activeuser}}"; return; -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 --- Comment #11 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- - $debug and warn "Error ExportFramework $@\n"; + Koha::Logger->get->warn("Error ExportFramework $@"); Warn instead of debug ? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 --- Comment #12 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- More cases of the former too -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 --- Comment #13 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- -BEGIN { - $DEBUG = ($ENV{DEBUG}) ? 1 : 0; -} We still have other cases of using $ENV{DEBUG} ? What about them? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 --- Comment #14 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- git grep "C4::Debug" misc/admin/koha-preferences:use C4::Debug; misc/admin/koha-preferences: print STDERR $message . "\n" if ( $C4::Debug::debug ); -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |28590 --- Comment #15 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- (In reply to Marcel de Rooy from comment #9)
Just mentioning one compile error:
perl -c tools/viewlog.pl
Oops, there was a missing dependency on bug 28590. (In reply to Marcel de Rooy from comment #11)
- $debug and warn "Error ExportFramework $@\n"; + Koha::Logger->get->warn("Error ExportFramework $@");
Warn instead of debug ?
Yes, those are warnings (export errors). We can lower them later if it's too noisy. (In reply to Marcel de Rooy from comment #13)
-BEGIN { - $DEBUG = ($ENV{DEBUG}) ? 1 : 0; -}
We still have other cases of using $ENV{DEBUG} ? What about them?
This report was about C4::Debug only, we could extend it to DEBUG. (In reply to Marcel de Rooy from comment #14)
git grep "C4::Debug" misc/admin/koha-preferences:use C4::Debug; misc/admin/koha-preferences: print STDERR $message . "\n" if ( $C4::Debug::debug );
Oops, my 'git grep' alias is not picking files without extension it seems! Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28590 [Bug 28590] get_shelves_userenv and set_shelves_userenv not used -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 --- Comment #16 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 122216 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=122216&action=edit Bug 28572: Replace missing occurrence in misc/admin/koha-preferences -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 --- Comment #17 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- (In reply to Jonathan Druart from comment #15)
(In reply to Marcel de Rooy from comment #9)
-BEGIN { - $DEBUG = ($ENV{DEBUG}) ? 1 : 0; -}
We still have other cases of using $ENV{DEBUG} ? What about them?
This report was about C4::Debug only, we could extend it to DEBUG.
Pfiou, that's painful. I would prefer to do that on a separate bug report, unless someone else is volunteering. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #122147|0 |1 is obsolete| | --- Comment #18 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 122217 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=122217&action=edit Bug 28572: Remove C4::Debug We are using Koha::Logger when it makes sense to keep the info, otherwise we simply remove it Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #122216|0 |1 is obsolete| | --- Comment #19 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 122218 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=122218&action=edit Bug 28572: Replace missing occurrence in misc/admin/koha-preferences Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |28606 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28606 [Bug 28606] Replace $ENV{DEBUG} and $DEBUG with Koha::Logger->debug -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au --- Comment #20 from David Cook <dcook@prosentient.com.au> --- Awesome. I don't think C4::Debug even works that well with Plack? Looking forward to seeing this one in action.. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 --- Comment #21 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Second patch will be squashed when pushed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |21.11.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 --- Comment #22 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Pushed to master for 21.11, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 --- Comment #23 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 122290 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=122290&action=edit Bug 28572: Fix misc/admin/koha-preferences -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 --- Comment #24 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Created attachment 122291 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=122291&action=edit Bug 28572: Fix Search.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|rel_21_11_candidate |additional_work_needed --- Comment #25 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- (In reply to Jonathan Druart from comment #24)
Created attachment 122291 [details] [review] Bug 28572: Fix Search.t
This does not work, "Can't open /var/log/z3950-error.log (Permission denied)" We need to mock the log4perl configuration for tests or we are going to face a lot of issues. Any good ideas? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 --- Comment #26 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 122303 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=122303&action=edit Bug 28572: Set missing __LOG_DIR__ variable in zebra_config.pl This patch makes zebra_config.pl create a temporary directory for logs and sets it in ENV so, when called, rewrite-config.PL sets it correctly. It also adds the new syspref Reference_NFL_Statuses to the big mock to silence many warnings introduced by bug 21260. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 --- Comment #27 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Ok, Search.t got too noisy. It is because of undefined stuffs. It can be trivially fixed, but I also noticed that some warns that got replaced by calls to the logger, got the if $DEBUG; removed. Is that intended? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 --- Comment #28 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Tomás Cohen Arazi from comment #27)
Ok, Search.t got too noisy. It is because of undefined stuffs. It can be trivially fixed, but I also noticed that some warns that got replaced by calls to the logger, got the if $DEBUG; removed. Is that intended?
I wasn't paying attention :-D Koha::Logger, log level. he. Patch coming. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 --- Comment #29 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 122304 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=122304&action=edit Bug 28572: Avoid useless warnings There are too many warnings about uninitialized variables in Search.pm. This patch deals with that, the same way it is dealt accross the file: by setting an empty string when things are not defined. To test: 1. Run: $ kshell k$ prove t/db_dependent/Search.t => FAIL: Wow, too many warnings. Some related to this bug, some not. 2. Apply this patch 3. Repeat 1 => SUCCESS: No more warnings! 4. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |28615 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28615 [Bug 28615] Add a simple way to mock Koha::Logger -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #122304|0 |1 is obsolete| | --- Comment #30 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Comment on attachment 122304 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=122304 Bug 28572: Avoid useless warnings Patch moved to bug 28483 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 --- Comment #31 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- c2fb056d7dc Bug 28572: Set missing __LOG_DIR__ variable in zebra_config.pl 3d1a92b6e1c Bug 28572: Fix Search.t 438cfbe1fc3 Bug 28572: Fix misc/admin/koha-preferences Pushed to master. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Bug 28572 depends on bug 28590, which changed state. Bug 28590 Summary: get_shelves_userenv and set_shelves_userenv not used https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28590 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Bug 28572 depends on bug 28591, which changed state. Bug 28591 Summary: debug passed to get_template_and_user but not used https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28591 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|Pushed to master |RESOLVED --- Comment #32 from Kyle M Hall <kyle@bywatersolutions.com> --- Enhancement not backported to 21.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Bug 28572 depends on bug 28570, which changed state. Bug 28570 Summary: bor_issues_top.pl using a /tmp file to log debug https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28570 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to oldstable |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|additional_work_needed | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28572 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |This patch simplifies and release notes| |clarifies how developers | |should add debug statements | |to the Koha codebase. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org