This is an automated email from the ASF dual-hosted git repository.

cziegeler pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-event.git


The following commit(s) were added to refs/heads/master by this push:
     new d8b7dd6  Add more debug logging
d8b7dd6 is described below

commit d8b7dd61d6cd5bd9f3dc9c24825330a4236ea296
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Sun Aug 30 16:34:37 2020 +0200

    Add more debug logging
---
 .../apache/sling/event/impl/jobs/notifications/NewJobSender.java | 9 ++++++---
 .../org/apache/sling/event/impl/jobs/queues/QueueManager.java    | 2 ++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/event/impl/jobs/notifications/NewJobSender.java
 
b/src/main/java/org/apache/sling/event/impl/jobs/notifications/NewJobSender.java
index dc16be2..668508d 100644
--- 
a/src/main/java/org/apache/sling/event/impl/jobs/notifications/NewJobSender.java
+++ 
b/src/main/java/org/apache/sling/event/impl/jobs/notifications/NewJobSender.java
@@ -76,6 +76,7 @@ public class NewJobSender implements ResourceChangeListener, 
ExternalResourceCha
         properties.put(ResourceChangeListener.PATHS, 
this.configuration.getLocalJobsPath());
 
         this.listenerRegistration = 
bundleContext.registerService(ResourceChangeListener.class, this, properties);
+        logger.debug("Registered resource event listener for {}", 
this.configuration.getLocalJobsPath());
     }
 
     /**
@@ -88,14 +89,15 @@ public class NewJobSender implements 
ResourceChangeListener, ExternalResourceCha
             this.listenerRegistration.unregister();
             this.listenerRegistration = null;
         }
+        logger.debug("Deactivating resource event listener");
     }
 
     @Override
        public void onChange(final List<ResourceChange> resourceChanges) {
        for(final ResourceChange resourceChange : resourceChanges) {
-               logger.debug("Received event {}", resourceChange);
+            final String path = resourceChange.getPath();
 
-               final String path = resourceChange.getPath();
+            logger.debug("Received event {} : {}", 
resourceChange.getType().name(), path);
 
                final int topicStart = 
this.configuration.getLocalJobsPath().length() + 1;
                final int topicEnd = path.indexOf('/', topicStart);
@@ -109,12 +111,13 @@ public class NewJobSender implements 
ResourceChangeListener, ExternalResourceCha
                        
properties.put(NotificationConstants.NOTIFICATION_PROPERTY_JOB_ID, jobId);
                     
properties.put(NotificationConstants.NOTIFICATION_PROPERTY_JOB_TOPIC, topic);
 
-                 // we also set internally the queue name
+                     // we also set internally the queue name
                     final String queueName = 
this.configuration.getQueueConfigurationManager().getQueueInfo(topic).queueName;
                     properties.put(Job.PROPERTY_JOB_QUEUE_NAME, queueName);
 
                     final Event jobEvent = new 
Event(NotificationConstants.TOPIC_JOB_ADDED, properties);
                     // as this is send within handling an event, we do sync 
call
+                    logger.debug("Sending event {} : {}", topic, jobId);
                     this.eventAdmin.sendEvent(jobEvent);
                 }
                }
diff --git 
a/src/main/java/org/apache/sling/event/impl/jobs/queues/QueueManager.java 
b/src/main/java/org/apache/sling/event/impl/jobs/queues/QueueManager.java
index 11f24a9..40edb37 100644
--- a/src/main/java/org/apache/sling/event/impl/jobs/queues/QueueManager.java
+++ b/src/main/java/org/apache/sling/event/impl/jobs/queues/QueueManager.java
@@ -242,6 +242,7 @@ public class QueueManager
             }
         }
         if ( queue != null ) {
+            logger.debug("Starting queue {}", queueInfo.queueName);
             if ( !isNewQueue ) {
                 queue.wakeUpQueue(topics);
             }
@@ -406,6 +407,7 @@ public class QueueManager
     public void handleEvent(final Event event) {
         final String topic = 
(String)event.getProperty(NotificationConstants.NOTIFICATION_PROPERTY_JOB_TOPIC);
         if ( this.isActive.get() && topic != null ) {
+            logger.debug("Received event {}", topic);
             final QueueInfo info = 
this.configuration.getQueueConfigurationManager().getQueueInfo(topic);
             this.start(info, Collections.singleton(topic));
         }

Reply via email to