jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1755373 - in /jmeter/trunk: ./ res/maven/ src/core/org/apache/jmeter/logging/ src/core/org/slf4j/ src/slf4j-logkit/ src/slf4j-logkit/org/ src/slf4j-logkit/org/apache/ src/slf4j-logkit/org/apache/jmeter/ src/slf4j-logkit/org/apache/jmeter/l...
Date Fri, 05 Aug 2016 19:13:00 GMT
Author: pmouawad
Date: Fri Aug  5 19:13:00 2016
New Revision: 1755373

URL: http://svn.apache.org/viewvc?rev=1755373&view=rev
Log:
Bug 59777 - Extract slf4j binding into its own jar and make it a jmeter lib
Bugzilla Id: 59777

Added:
    jmeter/trunk/res/maven/ApacheJMeter_slf4j_logkit.pom
    jmeter/trunk/src/slf4j-logkit/
    jmeter/trunk/src/slf4j-logkit/org/
    jmeter/trunk/src/slf4j-logkit/org/apache/
    jmeter/trunk/src/slf4j-logkit/org/apache/jmeter/
    jmeter/trunk/src/slf4j-logkit/org/apache/jmeter/logging/
    jmeter/trunk/src/slf4j-logkit/org/apache/jmeter/logging/LogkitLoggerAdapter.java   (with
props)
    jmeter/trunk/src/slf4j-logkit/org/apache/jmeter/logging/LogkitLoggerFactory.java   (with
props)
    jmeter/trunk/src/slf4j-logkit/org/slf4j/
    jmeter/trunk/src/slf4j-logkit/org/slf4j/impl/
    jmeter/trunk/src/slf4j-logkit/org/slf4j/impl/StaticLoggerBinder.java   (with props)
Removed:
    jmeter/trunk/src/core/org/apache/jmeter/logging/
    jmeter/trunk/src/core/org/slf4j/
Modified:
    jmeter/trunk/build.xml
    jmeter/trunk/eclipse.classpath
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/build.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/build.xml?rev=1755373&r1=1755372&r2=1755373&view=diff
==============================================================================
--- jmeter/trunk/build.xml (original)
+++ jmeter/trunk/build.xml Fri Aug  5 19:13:00 2016
@@ -135,6 +135,7 @@
       <sourcePath path="${src.components}" />
       <sourcePath path="${src.functions}" />
       <class location="${lib.dir}/jorphan.jar" />
+      <class location="${lib.dir}/ApacheJMeter_slf4j_logkit.jar"/>
       <class location="${dest.jar}/ApacheJMeter_components.jar"/>
       <class location="${dest.jar}/ApacheJMeter_components.jar"/>
       <class location="${dest.jar}/ApacheJMeter_core.jar"/>
@@ -152,6 +153,7 @@
       <class location="${dest.jar}/ApacheJMeter_mongodb.jar"/>
       <class location="${dest.jar}/ApacheJMeter_tcp.jar"/>
       <class location="${dest.jar.jmeter}/ApacheJMeter.jar" />
+      <sourcePath path="${src.slf4j_logkit}" />
       <sourcePath path="${src.jorphan}" />
       <sourcePath path="${src.tcp}" />
       <sourcePath path="${src.jms}" />
@@ -220,6 +222,7 @@
   <property name="src.jms" value="src/protocol/jms"/>
   <property name="src.native" value="src/protocol/native"/>
   <property name="src.mongodb" value="src/protocol/mongodb"/>
+  <property name="src.slf4j_logkit" value="src/slf4j-logkit"/>
 
   <!-- Where the documentation sources live -->
   <property name="src.docs" value="xdocs"/>
@@ -247,6 +250,7 @@
     <pathelement location="${src.jms}"/>
     <pathelement location="${src.native}"/>
     <pathelement location="${src.mongodb}"/>
+    <pathelement location="${src.slf4j_logkit}"/>
   </path>
 
   <!-- Temporary build directories: where the .class live -->
@@ -269,6 +273,7 @@
   <property name="build.jms" value="build/protocol/jms"/>
   <property name="build.native" value="build/protocol/native"/>
   <property name="build.mongodb" value="build/protocol/mongodb"/>
+  <property name="build.slf4j_logkit" value="build/slf4j-logkit"/>
   <property name="build.test" value="build/test"/>
   <property name="build.res" value="build/res"/>
   <property name="build.test-res" value="test/resources"/>
@@ -499,12 +504,20 @@
     <pathelement location="${lib.dir}/${xstream.jar}"/>
     <!-- Generated jars -->
     <fileset dir="${lib.dir}" includes="jorphan.jar"/>
+  	<fileset dir="${lib.dir}" includes="ApacheJMeter_slf4j_logkit.jar"/>
     <!-- API-only jars-->
     <fileset dir="${lib.api}" includes="*.jar"/>
     <!-- Optional jars -->
     <fileset dir="${lib.opt}" includes="*.jar"/>
   </path>
 
+	
+  <path id="slf4j_logkit_classpath">
+    <!-- Externally produced jars -->
+    <pathelement location="${lib.dir}/${logkit.jar}"/>
+    <pathelement location="${lib.dir}/${slf4j-api.jar}"/>
+  </path>
+	
   <!-- Anakia classpath -->
   <path id="anakia.classpath">
     <pathelement location="${lib.doc}/${velocity.jar}"/>
@@ -816,6 +829,17 @@
       </classpath>
     </javac>
   </target>
+	
+  <target name="compile-slf4j_logkit" description="Compile JMeter slf4j LogKit bootstrap
classes.">
+    <mkdir dir="${build.slf4j_logkit}"/>
+    <javac srcdir="${src.slf4j_logkit}" destdir="${build.slf4j_logkit}" source="${src.java.version}"
optimize="${optimize}" debug="on" target="${target.java.version}"
+           includeAntRuntime="${includeAntRuntime}" deprecation="${deprecation}" encoding="${encoding}">
+      <include name="**/*.java"/>
+      <classpath>
+	    <path refid="slf4j_logkit_classpath"/>
+	  </classpath>
+    </javac>
+  </target>
 
   <target name="compile-jms" depends="compile-jorphan,compile-core,compile-components"
         description="Compile components specific to JMS sampling.">
@@ -860,7 +884,7 @@
   </target>
 
   <target name="compile"
-  depends="_message_3rdParty,compile-core,compile-components,compile-functions,compile-protocols,compile-monitor,compile-junit,compile-jms,compile-native,
compile-mongodb"
+  depends="_message_3rdParty,compile-slf4j_logkit,compile-core,compile-components,compile-functions,compile-protocols,compile-monitor,compile-junit,compile-jms,compile-native,
compile-mongodb"
   description="Compile everything."/>
 
   <target name="run_gui" depends="package" description="Run the JMeter GUI off the jar
files">
@@ -1147,6 +1171,18 @@ run JMeter unless all the JMeter jars ar
       <fileset dir="${src.mongodb}" includes="**/*.properties" />
     </jar>
 
+    <!-- slf4j-logkit -->
+    <!-- Ensure that build dir exists, even if slf4j-logkit has not been built -->
+    <mkdir dir="${build.slf4j_logkit}"/>
+    <jar jarfile="${lib.dir}/ApacheJMeter_slf4j_logkit.jar" manifest="${build.dir}/MANIFEST_BIN.MF">
+      <zipfileset file="${resources.meta-inf}/default.notice"
+        fullpath="META-INF/NOTICE" />
+      <zipfileset file="${resources.meta-inf}/default.license"
+        fullpath="META-INF/LICENSE" />
+      <fileset dir="${build.slf4j_logkit}" includes="**/*.class" />
+      <fileset dir="${src.slf4j_logkit}" includes="**/*.properties" />
+    </jar>
+
     <jar jarfile="${lib.dir}/jorphan.jar" manifest="${build.dir}/MANIFEST_BIN.MF">
       <zipfileset file="${resources.meta-inf}/default.notice"
           fullpath="META-INF/NOTICE" />
@@ -1298,6 +1334,7 @@ run JMeter unless all the JMeter jars ar
     <include name="${dest.jar}/"/>
     <include name="${lib.dir}/bshclient.jar"/>
     <include name="${lib.dir}/jorphan.jar"/>
+  	<include name="${lib.dir}/ApacheJMeter_slf4j_logkit.jar"/>
     <include name="${lib.dir}/junit/test.jar"/>
     <include name="${dest.jar.jmeter}/ApacheJMeter.jar"/>
     <!-- Help documentation, binary files -->
@@ -1605,6 +1642,7 @@ run JMeter unless all the JMeter jars ar
       <fileset dir="${dest.jar}" includes="ApacheJMeter*.jar"/>
       <fileset dir="${dest.jar.jmeter}" includes="ApacheJMeter.jar"/>
       <fileset dir="${lib.dir}" includes="jorphan.jar"/>
+      <fileset dir="${lib.dir}" includes="ApacheJMeter_slf4j_logkit.jar"/>
     </copy>
     <copy tofile="${maven.dir}/ApacheJMeter_junit-test.jar" file="${lib.dir}/junit/test.jar"/>
     <!--
@@ -1983,6 +2021,7 @@ run JMeter unless all the JMeter jars ar
 
     <deployfile stem="ApacheJMeter_parent" packaging="pom"/>
     <deployfile stem="jorphan"/>
+    <deployfile stem="ApacheJMeter_slf4j_logkit"/>
     <deployfile stem="ApacheJMeter"/>
     <deployfile stem="ApacheJMeter_components"/>
     <deployfile stem="ApacheJMeter_config"/>
@@ -2221,6 +2260,7 @@ run JMeter unless all the JMeter jars ar
     <delete quiet="false" failonerror="false">
       <fileset dir="${dest.jar.jmeter}" includes="ApacheJMeter.jar"/>
       <fileset dir="${lib.dir}" includes="jorphan.jar"/>
+      <fileset dir="${lib.dir}" includes="ApacheJMeter_slf4j_logkit.jar"/>
       <fileset dir="${lib.dir}" includes="bshclient.jar"/>
       <fileset dir="${dest.jar}" includes="*.jar"/>
       <fileset dir="${build.dir}"/>

Modified: jmeter/trunk/eclipse.classpath
URL: http://svn.apache.org/viewvc/jmeter/trunk/eclipse.classpath?rev=1755373&r1=1755372&r2=1755373&view=diff
==============================================================================
--- jmeter/trunk/eclipse.classpath (original)
+++ jmeter/trunk/eclipse.classpath Fri Aug  5 19:13:00 2016
@@ -42,6 +42,7 @@
 	<classpathentry kind="src" output="build/protocol/mongodb" path="src/protocol/mongodb"/>
 	<classpathentry kind="src" output="build/protocol/native" path="src/protocol/native"/>
 	<classpathentry kind="src" output="build/protocol/tcp" path="src/protocol/tcp"/>
+	<classpathentry kind="src" output="build/slf4j-logkit" path="src/slf4j-logkit"/>
 	<classpathentry kind="src" output="build/test" path="test/src"/>
 	<classpathentry kind="lib" path="lib/accessors-smart-1.1.jar"/>
 	<classpathentry kind="lib" path="lib/asm-5.1.jar"/>

Added: jmeter/trunk/res/maven/ApacheJMeter_slf4j_logkit.pom
URL: http://svn.apache.org/viewvc/jmeter/trunk/res/maven/ApacheJMeter_slf4j_logkit.pom?rev=1755373&view=auto
==============================================================================
--- jmeter/trunk/res/maven/ApacheJMeter_slf4j_logkit.pom (added)
+++ jmeter/trunk/res/maven/ApacheJMeter_slf4j_logkit.pom Fri Aug  5 19:13:00 2016
@@ -0,0 +1,70 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.jmeter</groupId>
+    <artifactId>ApacheJMeter_slf4j_logkit</artifactId>
+    <version>@MAVEN.DEPLOY.VERSION@</version>
+    <name>Apache JMeter SLF4J Logkit</name>
+    <!-- Parent poms have to be packaged as pom, not jar -->
+    <packaging>pom</packaging>
+
+    <description>Apache JMeter SLF4K Logkit is open source software, it is a slf4j
binding for logkit used by Apache JMeter
+    </description>
+    <url>http://jmeter.apache.org/</url>
+    <inceptionYear>2016</inceptionYear>
+    <licenses>
+        <license>
+            <name>Apache 2</name>
+            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+            <distribution>repo</distribution>
+            <comments>A business-friendly OSS license</comments>
+        </license>
+    </licenses>
+    <issueManagement>
+        <system>bugzilla</system>
+        <url>https://bz.apache.org/bugzilla/describecomponents.cgi?product=JMeter</url>
+    </issueManagement>
+    <scm>
+        <connection>http://svn.apache.org/repos/asf/jmeter/trunk/</connection>
+        <developerConnection>https://svn.apache.org/repos/asf/jmeter/trunk/</developerConnection>
+        <url>http://svn.apache.org/viewvc/jmeter/trunk/</url>
+    </scm>
+
+
+    <properties>
+      <!-- these must agree with the definitions in build.properties -->
+      <logkit.version>2.0</logkit.version>
+      <slf4j-api.version>1.7.13</slf4j-api.version>
+    </properties>
+
+    <dependencies>
+      <dependency>
+        <groupId>logkit</groupId>
+        <artifactId>logkit</artifactId>
+        <version>${logkit.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-api</artifactId>
+        <version>${slf4j-api.version}</version>
+      </dependency>
+    </dependencies>
+</project>

Added: jmeter/trunk/src/slf4j-logkit/org/apache/jmeter/logging/LogkitLoggerAdapter.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/slf4j-logkit/org/apache/jmeter/logging/LogkitLoggerAdapter.java?rev=1755373&view=auto
==============================================================================
--- jmeter/trunk/src/slf4j-logkit/org/apache/jmeter/logging/LogkitLoggerAdapter.java (added)
+++ jmeter/trunk/src/slf4j-logkit/org/apache/jmeter/logging/LogkitLoggerAdapter.java Fri Aug
 5 19:13:00 2016
@@ -0,0 +1,327 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.jmeter.logging;
+
+import java.io.Serializable;
+
+import org.apache.log.Logger;
+import org.apache.log.Priority;
+import org.slf4j.helpers.FormattingTuple;
+import org.slf4j.helpers.MarkerIgnoringBase;
+import org.slf4j.helpers.MessageFormatter;
+
+/**
+ * Logkit adapter for slf4j 
+ * @since 3.0
+ */
+public class LogkitLoggerAdapter extends MarkerIgnoringBase implements Serializable {
+
+    final transient Logger logger;
+
+    private static final long serialVersionUID = -122848886791823355L;
+
+    /**
+     * @deprecated Only for use by JUnit
+     */
+    @Deprecated // only for Unit test usage
+    public LogkitLoggerAdapter() {
+        super();
+        this.logger = null;
+    }
+    
+    LogkitLoggerAdapter(org.apache.log.Logger logkitLogger) {
+        this.logger = logkitLogger;
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#debug(java.lang.String)
+     */
+    @Override
+    public void debug(String msg) {
+        logger.debug(msg);
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#debug(java.lang.String, java.lang.Object)
+     */
+    @Override
+    public void debug(String format, Object arg) {
+        if (logger.isDebugEnabled()) {
+            FormattingTuple ft = MessageFormatter.format(format, arg);
+            logger.log(Priority.DEBUG, ft.getMessage(), ft.getThrowable());
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#debug(java.lang.String, java.lang.Object[])
+     */
+    @Override
+    public void debug(String format, Object... args) {
+        if (logger.isDebugEnabled()) {
+            FormattingTuple ft = MessageFormatter.format(format, args);
+            logger.log(Priority.DEBUG, ft.getMessage(), ft.getThrowable());
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#debug(java.lang.String, java.lang.Throwable)
+     */
+    @Override
+    public void debug(String msg, Throwable throwable) {
+        logger.log(Priority.DEBUG, msg, throwable);
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#debug(java.lang.String, java.lang.Object, java.lang.Object)
+     */
+    @Override
+    public void debug(String format, Object arg1, Object arg2) {
+        FormattingTuple ft = MessageFormatter.format(format, arg1, arg2);
+        logger.log(Priority.DEBUG, ft.getMessage(), ft.getThrowable());
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#error(java.lang.String)
+     */
+    @Override
+    public void error(String message) {
+        logger.log(Priority.ERROR, message);
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#error(java.lang.String, java.lang.Object)
+     */
+    @Override
+    public void error(String format, Object arg) {
+        if (logger.isErrorEnabled()) {
+            FormattingTuple ft = MessageFormatter.format(format, arg);
+            logger.log(Priority.ERROR, ft.getMessage(), ft.getThrowable());
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#error(java.lang.String, java.lang.Object[])
+     */
+    @Override
+    public void error(String format, Object... args) {
+        if (logger.isErrorEnabled()) {
+            FormattingTuple ft = MessageFormatter.format(format, args);
+            logger.log(Priority.ERROR, ft.getMessage(), ft.getThrowable());
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#error(java.lang.String, java.lang.Throwable)
+     */
+    @Override
+    public void error(String message, Throwable throwable) {
+        if (logger.isErrorEnabled()) {
+            logger.log(Priority.ERROR, message, throwable);
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#error(java.lang.String, java.lang.Object, java.lang.Object)
+     */
+    @Override
+    public void error(String format, Object arg1, Object arg2) {
+        if (logger.isErrorEnabled()) {
+            FormattingTuple ft = MessageFormatter.format(format, arg1, arg2);
+            logger.log(Priority.ERROR, ft.getMessage(), ft.getThrowable());
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#info(java.lang.String)
+     */
+    @Override
+    public void info(String message) {
+        logger.log(Priority.INFO, message);
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#info(java.lang.String, java.lang.Object)
+     */
+    @Override
+    public void info(String format, Object arg1) {
+        if (logger.isInfoEnabled()) {
+            FormattingTuple ft = MessageFormatter.format(format, arg1);
+            logger.log(Priority.INFO, ft.getMessage(), ft.getThrowable());
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#info(java.lang.String, java.lang.Object[])
+     */
+    @Override
+    public void info(String format, Object... args) {
+        if (logger.isInfoEnabled()) {
+            FormattingTuple ft = MessageFormatter.format(format, args);
+            logger.log(Priority.INFO, ft.getMessage(), ft.getThrowable());
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#info(java.lang.String, java.lang.Throwable)
+     */
+    @Override
+    public void info(String message, Throwable throwable) {
+        logger.log(Priority.INFO, message, throwable);
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#info(java.lang.String, java.lang.Object, java.lang.Object)
+     */
+    @Override
+    public void info(String format, Object arg1, Object arg2) {
+        if (logger.isInfoEnabled()) {
+            FormattingTuple ft = MessageFormatter.format(format, arg1, arg2);
+            logger.log(Priority.INFO, ft.getMessage(), ft.getThrowable());
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#isDebugEnabled()
+     */
+    @Override
+    public boolean isDebugEnabled() {
+        return logger.isDebugEnabled();
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#isErrorEnabled()
+     */
+    @Override
+    public boolean isErrorEnabled() {
+        return logger.isErrorEnabled();
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#isInfoEnabled()
+     */
+    @Override
+    public boolean isInfoEnabled() {
+        return logger.isInfoEnabled();
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#isTraceEnabled()
+     */
+    @Override
+    public boolean isTraceEnabled() {
+        return logger.isDebugEnabled();
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#isWarnEnabled()
+     */
+    @Override
+    public boolean isWarnEnabled() {
+        return logger.isWarnEnabled();
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#warn(java.lang.String)
+     */
+    @Override
+    public void warn(String message) {
+        logger.log(Priority.WARN, message);
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#warn(java.lang.String, java.lang.Object)
+     */
+    @Override
+    public void warn(String format, Object arg) {
+        if (logger.isWarnEnabled()) {
+            FormattingTuple ft = MessageFormatter.format(format, arg);
+            logger.log(Priority.WARN, ft.getMessage(), ft.getThrowable());
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#warn(java.lang.String, java.lang.Object[])
+     */
+    @Override
+    public void warn(String format, Object... args) {
+        if (logger.isWarnEnabled()) {
+            FormattingTuple ft = MessageFormatter.format(format, args);
+            logger.log(Priority.WARN, ft.getMessage(), ft.getThrowable());
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#warn(java.lang.String, java.lang.Throwable)
+     */
+    @Override
+    public void warn(String message, Throwable throwable) {
+        logger.log(Priority.WARN, message, throwable);
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#warn(java.lang.String, java.lang.Object, java.lang.Object)
+     */
+    @Override
+    public void warn(String format, Object arg1, Object arg2) {
+        if (logger.isWarnEnabled()) {
+            FormattingTuple ft = MessageFormatter.format(format, arg1, arg2);
+            logger.log(Priority.WARN, ft.getMessage(), ft.getThrowable());
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#trace(java.lang.String)
+     */
+    @Override
+    public void trace(String message) {
+        debug(message);
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#trace(java.lang.String, java.lang.Object)
+     */
+    @Override
+    public void trace(String format, Object arg) {
+        debug(format, arg);
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#trace(java.lang.String, java.lang.Object[])
+     */
+    @Override
+    public void trace(String format, Object... args) {
+        debug(format, args);
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#trace(java.lang.String, java.lang.Throwable)
+     */
+    @Override
+    public void trace(String message, Throwable throwable) {
+        debug(message, throwable);
+    }
+
+    /* (non-Javadoc)
+     * @see org.slf4j.Logger#trace(java.lang.String, java.lang.Object, java.lang.Object)
+     */
+    @Override
+    public void trace(String format, Object arg1, Object arg2) {
+        debug(format, arg1, arg2);
+    }
+}

Propchange: jmeter/trunk/src/slf4j-logkit/org/apache/jmeter/logging/LogkitLoggerAdapter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jmeter/trunk/src/slf4j-logkit/org/apache/jmeter/logging/LogkitLoggerFactory.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/slf4j-logkit/org/apache/jmeter/logging/LogkitLoggerFactory.java?rev=1755373&view=auto
==============================================================================
--- jmeter/trunk/src/slf4j-logkit/org/apache/jmeter/logging/LogkitLoggerFactory.java (added)
+++ jmeter/trunk/src/slf4j-logkit/org/apache/jmeter/logging/LogkitLoggerFactory.java Fri Aug
 5 19:13:00 2016
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.jmeter.logging;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.log.Hierarchy;
+import org.slf4j.ILoggerFactory;
+import org.slf4j.Logger;
+
+/**
+ * Implementation of {@link ILoggerFactory} for Logkit
+ * @since 3.0
+ */
+public class LogkitLoggerFactory implements ILoggerFactory {
+    // key: name (String), value: a Log4jLogger;
+    private final Map<String, Logger> loggerMap;
+
+    /**
+     * 
+     */
+    public LogkitLoggerFactory() {
+        loggerMap = new HashMap<>();
+    }
+
+    /**
+     * 
+     * @see org.slf4j.ILoggerFactory#getLogger(java.lang.String)
+     */
+    @Override
+    public Logger getLogger(String name) {
+        Logger slf4jLogger = null;
+        if(name == null) {
+            name = Logger.ROOT_LOGGER_NAME;
+        }
+        // protect against concurrent access of loggerMap
+        synchronized (this) {
+            slf4jLogger = loggerMap.get(name);
+            if (slf4jLogger == null) {
+                org.apache.log.Logger logkitLogger;
+                if (name.equalsIgnoreCase(Logger.ROOT_LOGGER_NAME)) {
+                    logkitLogger = Hierarchy.getDefaultHierarchy().getRootLogger();
+                } else {
+                    logkitLogger = Hierarchy.getDefaultHierarchy().getLoggerFor(name);
+                }
+                slf4jLogger = new LogkitLoggerAdapter(logkitLogger);
+                loggerMap.put(name, slf4jLogger);
+            }
+        }
+        return slf4jLogger;
+    }
+}

Propchange: jmeter/trunk/src/slf4j-logkit/org/apache/jmeter/logging/LogkitLoggerFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: jmeter/trunk/src/slf4j-logkit/org/slf4j/impl/StaticLoggerBinder.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/slf4j-logkit/org/slf4j/impl/StaticLoggerBinder.java?rev=1755373&view=auto
==============================================================================
--- jmeter/trunk/src/slf4j-logkit/org/slf4j/impl/StaticLoggerBinder.java (added)
+++ jmeter/trunk/src/slf4j-logkit/org/slf4j/impl/StaticLoggerBinder.java Fri Aug  5 19:13:00
2016
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.slf4j.impl;
+
+import org.apache.jmeter.logging.LogkitLoggerFactory;
+import org.slf4j.ILoggerFactory;
+import org.slf4j.LoggerFactory;
+import org.slf4j.spi.LoggerFactoryBinder;
+
+/**
+ * The binding of {@link LoggerFactory} class with an actual instance of
+ * {@link ILoggerFactory} is performed using information returned by this class.
+ * 
+ * @since 3.0
+ */
+public class StaticLoggerBinder implements LoggerFactoryBinder {
+
+    /**
+     * The unique instance of this class.
+     * 
+     */
+    private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();
+
+    /**
+     * Return the singleton of this class.
+     * 
+     * @return the StaticLoggerBinder singleton
+     */
+    public static final StaticLoggerBinder getSingleton() {
+        return SINGLETON;
+    }
+
+    /**
+     * Declare the version of the SLF4J API this implementation is compiled
+     * against. The value of this field is usually modified with each release.
+     */
+    // to avoid constant folding by the compiler, this field must *not* be final
+    public static String REQUESTED_API_VERSION = "1.7"; // !final
+
+    private static final String loggerFactoryClassStr = LogkitLoggerFactory.class
+            .getName();
+
+    /**
+     * The ILoggerFactory instance returned by the {@link #getLoggerFactory}
+     * method should always be the same object
+     */
+    private final ILoggerFactory loggerFactory;
+
+    private StaticLoggerBinder() {
+        loggerFactory = new LogkitLoggerFactory();
+    }
+
+    @Override
+    public ILoggerFactory getLoggerFactory() {
+        return loggerFactory;
+    }
+
+    @Override
+    public String getLoggerFactoryClassStr() {
+        return loggerFactoryClassStr;
+    }
+}

Propchange: jmeter/trunk/src/slf4j-logkit/org/slf4j/impl/StaticLoggerBinder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1755373&r1=1755372&r2=1755373&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Fri Aug  5 19:13:00 2016
@@ -123,6 +123,7 @@ Summary
     <li><bug>59918</bug>Ant generated HTML report is broken (extras folder)</li>
     <li><bug>57493</bug>Create a documentation page for properties</li>
     <li><bug>59924</bug>The log level of XXX package is set to DEBUG if
<code>log_level.XXXX</code> property value contains spaces, same for __log function</li>
+    <li><bug>59777</bug>Extract slf4j binding into its own jar and make
it a jmeter lib</li>
 </ul>
 
 <ch_section>Non-functional changes</ch_section>



Mime
View raw message