More logging improvements to help tracking down hook problems

Add more informational logs:

- The configured hooks path.
- The resolved path for each hook.

Each of these is only logged once (the latter once per hook) so logging
at info level will not be obtrusive.

Log the path of the hook file if it does not exist. This is logged at
debug level because it will be emitted on every attempt to execute the
hook.

Change-Id: I1fe6f860346d73648283178b58982180d2c35ce9
diff --git a/src/main/java/com/googlesource/gerrit/plugins/hooks/HookExecutor.java b/src/main/java/com/googlesource/gerrit/plugins/hooks/HookExecutor.java
index 4a5f6bb..42d4e75 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/hooks/HookExecutor.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/hooks/HookExecutor.java
@@ -46,6 +46,7 @@
 
   HookResult submit(String projectName, Path hook, HookArgs args) {
     if (!Files.exists(hook)) {
+      log.debug("Hook file not found: {}", hook);
       return null;
     }
     HookTask.Sync hookTask = new HookTask.Sync(projectName, hook, args);
@@ -56,10 +57,10 @@
     try {
       return task.get(timeout, TimeUnit.SECONDS);
     } catch (TimeoutException e) {
-      message = "Synchronous hook timed out " + hook.toAbsolutePath();
+      message = "Synchronous hook timed out " + hook;
       log.error(message);
     } catch (Exception e) {
-      message = "Error running hook " + hook.toAbsolutePath();
+      message = "Error running hook " + hook;
       log.error(message, e);
     }
     task.cancel(true);
diff --git a/src/main/java/com/googlesource/gerrit/plugins/hooks/HookFactory.java b/src/main/java/com/googlesource/gerrit/plugins/hooks/HookFactory.java
index 2969358..81d1400 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/hooks/HookFactory.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/hooks/HookFactory.java
@@ -28,9 +28,13 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import org.eclipse.jgit.lib.Config;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @Singleton
 public class HookFactory {
+  private static final Logger log = LoggerFactory.getLogger(HookFactory.class);
+
   private final HookQueue queue;
   private final HookExecutor syncHookExecutor;
   private final Config config;
@@ -66,11 +70,14 @@
     } else {
       this.hooksPath = sitePaths.hooks_dir;
     }
+    log.info("hooks.path: {}", this.hooksPath);
   }
 
   private Path getHookPath(String configName, String defaultName) {
     String v = config.getString("hooks", null, configName);
-    return hooksPath.resolve(firstNonNull(v, defaultName));
+    Path hookPath = hooksPath.resolve(firstNonNull(v, defaultName));
+    log.info("hooks.{} resolved to {}", configName, hookPath);
+    return hookPath;
   }
 
   public AsynchronousHook createAsync(String configName, String defaultName) {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/hooks/HookQueue.java b/src/main/java/com/googlesource/gerrit/plugins/hooks/HookQueue.java
index 6a5e33e..be70d12 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/hooks/HookQueue.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/hooks/HookQueue.java
@@ -19,8 +19,12 @@
 import com.google.inject.Inject;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 class HookQueue implements LifecycleListener {
+  private static final Logger log = LoggerFactory.getLogger(HookQueue.class);
+
   private final WorkQueue workQueue;
 
   private WorkQueue.Executor queue;
@@ -35,9 +39,11 @@
   }
 
   void submit(String projectName, Path hook, HookArgs args) {
-    if (Files.exists(hook)) {
-      queue.submit(new HookTask.Async(projectName, hook, args));
+    if (!Files.exists(hook)) {
+      log.debug("Hook file not found: {}", hook.toAbsolutePath());
+      return;
     }
+    queue.submit(new HookTask.Async(projectName, hook, args));
   }
 
   @Override