I want to track the logs from my tests (or applications, if you do). For example, I might have a log line in code:
logger.info( "dummy log" );
However, when I start JMeter as follows:
jmeter -n -t foobar.jmx
I do not know where to look for this dummy magazine. So where does JMeter store test logs? Better yet, how can I configure it?
Many thanks.
Update
I forgot to mention that test logs were not found in the default log file jmeter.log. Is it true that test logs should be displayed in jmeter.logif some settings that prohibit the output of test logs are not set?
update 2
I have embedded jmeter.properties here: http://pastebin.com/6paTqRrK
Below are the relevant code snippets.
package foo.bar;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.junit.Assert.assertTrue;
public class DummyTest {
private static final Logger logger = LoggerFactory.getLogger( DummyTest.class.getName() );
@Test
public void test(){
System.out.println("dummy message");
logger.info("dummy log");
assertTrue( true );
}
}
Gradle build.gradle:
dependencies {
compile 'org.codehaus.groovy:groovy-all:2.2.1'
compile 'org.slf4j:slf4j-api:1.7.5'
runtime 'ch.qos.logback:logback-classic:1.0.13'
runtime 'ch.qos.logback:logback-core:1.0.13'
testCompile 'junit:junit:4.11'
}
jar {
from {
configurations.testRuntime.collect {
it.isDirectory() ? it : zipTree(it)
} + sourceSets.main.output + sourceSets.test.output
}
archiveName = 'junit_sampler.jar'
}
task updateJar( type: Copy, dependsOn: jar ) {
from './junit_sampler.jar'
into "${System.properties['user.home']}/opt/apache-jmeter-2.11/lib/junit"
}
foobar.jmx
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="2.6" jmeter="2.11 r1554548">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Check Logging" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp>
</TestPlan>
<hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Thread Group" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">3</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">1</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<longProp name="ThreadGroup.start_time">1399656770000</longProp>
<longProp name="ThreadGroup.end_time">1399656770000</longProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
</ThreadGroup>
<hashTree>
<JUnitSampler guiclass="JUnitTestSamplerGui" testclass="JUnitSampler" testname="JUnit Request" enabled="true">
<stringProp name="junitSampler.classname">foo.bar.DummyTest</stringProp>
<stringProp name="junitsampler.constructorstring"></stringProp>
<stringProp name="junitsampler.method">test</stringProp>
<stringProp name="junitsampler.pkg.filter"></stringProp>
<stringProp name="junitsampler.success">Test successful</stringProp>
<stringProp name="junitsampler.success.code">1000</stringProp>
<stringProp name="junitsampler.failure">Test failed</stringProp>
<stringProp name="junitsampler.failure.code">0001</stringProp>
<stringProp name="junitsampler.error">An unexpected error occured</stringProp>
<stringProp name="junitsampler.error.code">9999</stringProp>
<stringProp name="junitsampler.exec.setup">false</stringProp>
<stringProp name="junitsampler.append.error">false</stringProp>
<stringProp name="junitsampler.append.exception">false</stringProp>
<boolProp name="junitsampler.junit4">true</boolProp>
</JUnitSampler>
<hashTree/>
</hashTree>
</hashTree>
</hashTree>
</jmeterTestPlan>
-, " " jmeter.log.