Bugzilla – Attachment 176341 Details for
Bug 22415
Koha::EDI should not use Log::Log4perl directly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22415: Update EDI to use Koha::Logger
Bug-22415-Update-EDI-to-use-KohaLogger.patch (text/plain), 4.40 KB, created by
Kyle M Hall (khall)
on 2025-01-10 14:42:31 UTC
(
hide
)
Description:
Bug 22415: Update EDI to use Koha::Logger
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2025-01-10 14:42:31 UTC
Size:
4.40 KB
patch
obsolete
>From 990e07aa6c7921e63d31070640a6e56db6f33b1a Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 12 Dec 2024 13:26:15 +0000 >Subject: [PATCH] Bug 22415: Update EDI to use Koha::Logger > >This patch updates the EDI code to use the Koha::Logger wrapper in >preference to the bare Log::Log4perl module. > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/EDI.pm | 14 +++++++------- > misc/cronjobs/edi_cron.pl | 15 ++------------- > 2 files changed, 9 insertions(+), 20 deletions(-) > >diff --git a/Koha/EDI.pm b/Koha/EDI.pm >index 7b0eeb3657d..70a4b69dfc7 100644 >--- a/Koha/EDI.pm >+++ b/Koha/EDI.pm >@@ -39,8 +39,8 @@ use C4::Biblio qw( > use Koha::Edifact::Order; > use Koha::Edifact; > use C4::Log qw( logaction ); >-use Log::Log4perl; > use Text::Unidecode qw( unidecode ); >+use Koha::Logger; > use Koha::Plugins; # Adds plugin dirs to @INC > use Koha::Plugins::Handler; > use Koha::Acquisition::Baskets; >@@ -173,7 +173,7 @@ sub process_ordrsp { > $response_message->status('processing'); > $response_message->update; > my $schema = Koha::Database->new()->schema(); >- my $logger = Log::Log4perl->get_logger(); >+ my $logger = Koha::Logger->get({ interface => 'edi' }); > my $vendor_acct; > my $edi = > Koha::Edifact->new( { transmission => $response_message->raw_msg, } ); >@@ -227,7 +227,7 @@ sub process_invoice { > $invoice_message->status('processing'); > $invoice_message->update; > my $schema = Koha::Database->new()->schema(); >- my $logger = Log::Log4perl->get_logger(); >+ my $logger = Koha::Logger->get({ interface => 'edi' }); > my $vendor_acct; > > my $plugin_class = $invoice_message->edi_acct()->plugin(); >@@ -442,7 +442,7 @@ sub _get_invoiced_price { > > sub receipt_items { > my ( $schema, $inv_line, $ordernumber, $quantity ) = @_; >- my $logger = Log::Log4perl->get_logger(); >+ my $logger = Koha::Logger->get({ interface => 'edi' }); > > # itemnumber is not a foreign key ??? makes this a bit cumbersome > my @item_links = $schema->resultset('AqordersItem')->search( >@@ -542,7 +542,7 @@ sub transfer_items { > } > ++$gocc; > } >- my $logger = Log::Log4perl->get_logger(); >+ my $logger = Koha::Logger->get({ interface => 'edi' }); > my $o1 = $order_from->ordernumber; > my $o2 = $order_to->ordernumber; > $logger->warn("transferring $quantity copies from order $o1 to order $o2"); >@@ -586,7 +586,7 @@ sub process_quote { > > my $messages = $edi->message_array(); > my $process_errors = 0; >- my $logger = Log::Log4perl->get_logger(); >+ my $logger = Koha::Logger->get({ interface => 'edi' }); > my $schema = Koha::Database->new()->schema(); > my $message_count = 0; > my @added_baskets; # if auto & multiple baskets need to order all >@@ -671,7 +671,7 @@ sub quote_item { > my ( $item, $quote, $basketno ) = @_; > > my $schema = Koha::Database->new()->schema(); >- my $logger = Log::Log4perl->get_logger(); >+ my $logger = Koha::Logger->get({ interface => 'edi' }); > > # $basketno is the return from AddBasket in the calling routine > # So this call should not fail unless that has >diff --git a/misc/cronjobs/edi_cron.pl b/misc/cronjobs/edi_cron.pl >index e147204ff2d..1541b5dbde9 100755 >--- a/misc/cronjobs/edi_cron.pl >+++ b/misc/cronjobs/edi_cron.pl >@@ -31,26 +31,15 @@ use utf8; > > use Koha::Script -cron; > use C4::Context; >-use Log::Log4perl qw(:easy); > use Koha::Database; > use Koha::EDI qw( process_quote process_invoice process_ordrsp ); > use Koha::Edifact::Transport; >+use Koha::Logger; > use Koha::Plugins::Handler; > use Fcntl qw( LOCK_EX O_CREAT O_RDWR SEEK_SET ); > > die "Syspref 'EDIFACT' is disabled" unless C4::Context->preference('EDIFACT'); > >-my $logdir = C4::Context->config('logdir'); >- >-# logging set to trace as this may be what you >-# want on implementation >-Log::Log4perl->easy_init( >- { >- level => $TRACE, >- file => ">>$logdir/editrace.log", >- } >-); >- > # we dont have a lock dir in context so use the logdir > my $pidfile = "$logdir/edicron.pid"; > >@@ -60,7 +49,7 @@ my $schema = Koha::Database->new()->schema(); > > my @edi_accts = $schema->resultset('VendorEdiAccount')->all(); > >-my $logger = Log::Log4perl->get_logger(); >+my $logger = Koha::Logger->get({ interface => 'edi', prefix => 0 }); > > for my $acct (@edi_accts) { > if ( $acct->quotes_enabled ) { >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22415
:
175402
|
175403
|
175483
|
175484
| 176341 |
176342
|
176343