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

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new caf73e7  (chores) camel-test-infra-common: use a static field instead 
of creating the logger multiple times
caf73e7 is described below

commit caf73e7b4eaa6c978e550637d954e90f8453164b
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Tue Mar 29 15:59:30 2022 +0200

    (chores) camel-test-infra-common: use a static field instead of creating 
the logger multiple times
---
 .../apache/camel/test/infra/common/services/SingletonService.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/test-infra/camel-test-infra-common/src/test/java/org/apache/camel/test/infra/common/services/SingletonService.java
 
b/test-infra/camel-test-infra-common/src/test/java/org/apache/camel/test/infra/common/services/SingletonService.java
index e30fc73..a2a2e44 100644
--- 
a/test-infra/camel-test-infra-common/src/test/java/org/apache/camel/test/infra/common/services/SingletonService.java
+++ 
b/test-infra/camel-test-infra-common/src/test/java/org/apache/camel/test/infra/common/services/SingletonService.java
@@ -18,6 +18,7 @@
 package org.apache.camel.test.infra.common.services;
 
 import org.junit.jupiter.api.extension.ExtensionContext;
+import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
@@ -26,6 +27,8 @@ import org.slf4j.LoggerFactory;
  * @param <T> The type of the service to be wrapped
  */
 public class SingletonService<T extends TestService> implements 
ExtensionContext.Store.CloseableResource, TestService {
+    private static final Logger LOG = 
LoggerFactory.getLogger(SingletonService.class);
+
     private final T service;
     private final String name;
 
@@ -36,7 +39,7 @@ public class SingletonService<T extends TestService> 
implements ExtensionContext
 
     protected void addToStore(ExtensionContext extensionContext) {
         
extensionContext.getRoot().getStore(ExtensionContext.Namespace.GLOBAL).getOrComputeIfAbsent(name,
 s -> {
-            LoggerFactory.getLogger(SingletonService.class).debug("Registering 
singleton service {}", name);
+            LOG.debug("Registering singleton service {}", name);
             service.initialize();
             return this;
         });

Reply via email to