Author: fschumacher
Date: Sat Feb 9 11:55:47 2019
New Revision: 1853262
URL: http://svn.apache.org/viewvc?rev=1853262&view=rev
Log:
Use string formatting for logs
As this is an example class, it should be a good example for others to look at.
So
use string formatting, ask the log framework, if the log would be written and
don't
use variable names, that are hard to read.
Modified:
jmeter/trunk/src/examples/org/apache/jmeter/examples/sampler/ExampleSampler.java
Modified:
jmeter/trunk/src/examples/org/apache/jmeter/examples/sampler/ExampleSampler.java
URL:
http://svn.apache.org/viewvc/jmeter/trunk/src/examples/org/apache/jmeter/examples/sampler/ExampleSampler.java?rev=1853262&r1=1853261&r2=1853262&view=diff
==============================================================================
---
jmeter/trunk/src/examples/org/apache/jmeter/examples/sampler/ExampleSampler.java
(original)
+++
jmeter/trunk/src/examples/org/apache/jmeter/examples/sampler/ExampleSampler.java
Sat Feb 9 11:55:47 2019
@@ -119,9 +119,9 @@ public class ExampleSampler extends Abst
* Helper method
*/
private void trace(String s) {
- String tl = getTitle();
- String tn = Thread.currentThread().getName();
- String th = this.toString();
- log.debug(tn + " (" + classCount.get() + ") " + tl + " " + s + " " +
th);
+ if (log.isDebugEnabled()) {
+ log.debug("{} ({}) {} {} {}", Thread.currentThread().getName(),
Integer.valueOf(classCount.get()),
+ getTitle(), s, this.toString());
+ }
}
}