]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1441181 - Step 5 - Add logging to jobqueue
authorDylan William Hardison <dylan@hardison.net>
Tue, 13 Mar 2018 14:40:12 +0000 (10:40 -0400)
committerGitHub <noreply@github.com>
Tue, 13 Mar 2018 14:40:12 +0000 (10:40 -0400)
Bugzilla/JobQueue.pm
Bugzilla/JobQueue/Runner.pm

index e3cf9733f116ce37adbc179909b7b14f5a2d9d91..8c8d73dcd6b355e8a2904a8d7eed06fb470647c5 100644 (file)
@@ -11,6 +11,7 @@ use 5.10.1;
 use strict;
 use warnings;
 
+use Bugzilla::Logging;
 use Bugzilla::Constants;
 use Bugzilla::Error;
 use Bugzilla::Install::Util qw(install_string);
@@ -95,6 +96,14 @@ sub insert {
     return $retval;
 }
 
+sub debug {
+    my ($self, @args) = @_;
+    my $caller_pkg = caller;
+    local $Log::Log4perl::caller_depth = $Log::Log4perl::caller_depth + 1;
+    my $logger = Log::Log4perl->get_logger($caller_pkg);
+    $logger->debug(@args);
+}
+
 sub work {
     my ($self, $delay) = @_;
     $delay ||= 5;
@@ -105,6 +114,7 @@ sub work {
         reschedule     => 'drift',
         on_tick        => sub { $self->work_once }
     );
+    DEBUG("working every $delay seconds");
     $loop->add($timer);
     $timer->start;
     Future->wait_any(map { catch_signal($_) } qw( INT TERM HUP ))->get;
index d95f9c3c35402a682b74be9a3657878a14729423..a3cf3ff55d5e0cbe5ffe3ecb47717708d1496383 100644 (file)
@@ -16,6 +16,7 @@ use strict;
 use warnings;
 use autodie qw(open close unlink system);
 
+use Bugzilla::Logging;
 use Bugzilla::Constants;
 use Bugzilla::DaemonControl qw(:utils);
 use Bugzilla::JobQueue::Worker;