Author: pmouawad
Date: Sun Feb  5 22:22:46 2017
New Revision: 1781817

URL: http://svn.apache.org/viewvc?rev=1781817&view=rev
Log:
Bug 60564 - Migrating LogKit to SLF4J - Replace logkit loggers with slf4j ones 
with keeping the current logkit binding solution
Use slf4j parameterized messages
Bugzilla Id: 60564

Modified:
    
jmeter/trunk/src/junit/org/apache/jmeter/protocol/java/control/gui/JUnitTestSamplerGui.java
    
jmeter/trunk/src/junit/org/apache/jmeter/protocol/java/sampler/JUnitSampler.java

Modified: 
jmeter/trunk/src/junit/org/apache/jmeter/protocol/java/control/gui/JUnitTestSamplerGui.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/junit/org/apache/jmeter/protocol/java/control/gui/JUnitTestSamplerGui.java?rev=1781817&r1=1781816&r2=1781817&view=diff
==============================================================================
--- 
jmeter/trunk/src/junit/org/apache/jmeter/protocol/java/control/gui/JUnitTestSamplerGui.java
 (original)
+++ 
jmeter/trunk/src/junit/org/apache/jmeter/protocol/java/control/gui/JUnitTestSamplerGui.java
 Sun Feb  5 22:22:46 2017
@@ -36,21 +36,21 @@ import javax.swing.JPanel;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 
-import junit.framework.TestCase;
-
 import org.apache.jmeter.gui.util.VerticalPanel;
 import org.apache.jmeter.protocol.java.sampler.JUnitSampler;
 import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
 import org.apache.jmeter.testelement.TestElement;
 import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jorphan.gui.JLabeledTextField;
-import org.apache.jorphan.logging.LoggingManager;
 import org.apache.jorphan.reflect.ClassFinder;
 import org.apache.jorphan.util.JOrphanUtils;
-import org.apache.log.Logger;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import junit.framework.TestCase;
 
 /**
  * The <code>JUnitTestSamplerGui</code> class provides the user interface
@@ -62,7 +62,7 @@ implements ChangeListener, ActionListene
 {
     private static final long serialVersionUID = 240L;
 
-    private static final Logger log = LoggingManager.getLoggerForClass();
+    private static final Logger log = 
LoggerFactory.getLogger(JUnitTestSamplerGui.class);
 
     private static final String TESTMETHOD_PREFIX = "test"; //$NON-NLS-1$
 

Modified: 
jmeter/trunk/src/junit/org/apache/jmeter/protocol/java/sampler/JUnitSampler.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/junit/org/apache/jmeter/protocol/java/sampler/JUnitSampler.java?rev=1781817&r1=1781816&r2=1781817&view=diff
==============================================================================
--- 
jmeter/trunk/src/junit/org/apache/jmeter/protocol/java/sampler/JUnitSampler.java
 (original)
+++ 
jmeter/trunk/src/junit/org/apache/jmeter/protocol/java/sampler/JUnitSampler.java
 Sun Feb  5 22:22:46 2017
@@ -24,22 +24,22 @@ import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.util.Enumeration;
 
-import junit.framework.AssertionFailedError;
-import junit.framework.Protectable;
-import junit.framework.TestCase;
-import junit.framework.TestFailure;
-import junit.framework.TestResult;
-
 import org.apache.jmeter.samplers.AbstractSampler;
 import org.apache.jmeter.samplers.Entry;
 import org.apache.jmeter.samplers.SampleResult;
 import org.apache.jmeter.testelement.ThreadListener;
-import org.apache.jorphan.logging.LoggingManager;
-import org.apache.log.Logger;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.Test.None;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.Protectable;
+import junit.framework.TestCase;
+import junit.framework.TestFailure;
+import junit.framework.TestResult;
 
 /**
  *
@@ -50,7 +50,7 @@ import org.junit.Test.None;
  */
 public class JUnitSampler extends AbstractSampler implements ThreadListener {
 
-    private static final Logger log = LoggingManager.getLoggerForClass();
+    private static final Logger log = 
LoggerFactory.getLogger(JUnitSampler.class);
 
     private static final long serialVersionUID = 240L; // Remember to change 
this when the class changes ...
 
@@ -491,7 +491,7 @@ public class JUnitSampler extends Abstra
                 theclazz =
                     
Thread.currentThread().getContextClassLoader().loadClass(className.trim());
             } catch (ClassNotFoundException e) {
-                log.warn("ClassNotFoundException:: " + e.getMessage());
+                log.warn("ClassNotFoundException:: {}", e.getMessage());
             }
             if (theclazz != null) {
                 // first we see if the class declares a string
@@ -512,7 +512,7 @@ public class JUnitSampler extends Abstra
                         strCon = null;
                     }
                 } catch (NoSuchMethodException e) {
-                    log.info("Trying to find constructor with one String 
parameter returned error: " + e.getMessage());
+                    log.info("Trying to find constructor with one String 
parameter returned error: {}", e.getMessage());
                 }
                 try {
                     con = theclazz.getDeclaredConstructor(new Class[0]);
@@ -520,7 +520,7 @@ public class JUnitSampler extends Abstra
                         params = new Object[]{};
                     }
                 } catch (NoSuchMethodException e) {
-                    log.info("Trying to find empty constructor returned error: 
" + e.getMessage());
+                    log.info("Trying to find empty constructor returned error: 
{}", e.getMessage());
                 }
                 try {
                     // if the string constructor is not null, we use it.
@@ -531,11 +531,11 @@ public class JUnitSampler extends Abstra
                     } else if (con != null){
                         testclass = con.newInstance(params);
                     } else {
-                        log.error("No empty constructor nor string constructor 
found for class:"+theclazz);
+                        log.error("No empty constructor nor string constructor 
found for class:{}", theclazz);
                     }
                 } catch (InvocationTargetException | IllegalAccessException
                         | InstantiationException e) {
-                    log.error("Error instantiating 
class:"+theclazz+":"+e.getMessage(), e);
+                    log.error("Error instantiating class:{}:{}", theclazz, 
e.getMessage(), e);
                 }
             }
         }


Reply via email to