Skip to content

Log Levels and directory

Vincent DABURON edited this page Nov 21, 2022 · 1 revision

Log Levels and directory


How To <overrideRootLogLevel>

You can specify a root log level for debug purposes.

<project>
    [...]
        <build>
            <plugins>
                <plugin>
                    <groupId>com.lazerycode.jmeter</groupId>
                    <artifactId>jmeter-maven-plugin</artifactId>
                    <version>3.6.0</version>
                    <executions>
                        <!-- Generate JMeter configuration -->
                        <execution>
                            <id>configuration</id>
                            <goals>
                                <goal>configure</goal>
                            </goals>
                        </execution>
                        <!-- Run JMeter tests -->
                        <execution>
                            <id>jmeter-tests</id>
                            <goals>
                                <goal>jmeter</goal>
                            </goals>
                        </execution>
                        <!-- Fail build on errors in test -->
                        <execution>
                            <id>jmeter-check-results</id>
                            <goals>
                                <goal>results</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <overrideRootLogLevel>debug</overrideRootLogLevel>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    [...]
</project>

Setting the root log level will always override any settings for individual category log levels (as a result if the <overrideRootLogLevel> is set all category log levels set elsewhere will be ignored.

Advanced Log Configuration

If you add a "log4j2.xml" into the <confFilesDirectory> (defaults to ${project.base.directory}/src/test/conf) it will now be copied into the /bin folder. If one does not exist the default one supplied with JMeter will be used instead.

Individual Log Levels

You can override individual log levels by setting them in your jmeter.properties file. If you want to override them in the POM have a look at Adding Additional Properties To <propertiesJMeter>.

Set the log directory

By default the log directory is ${project.build.directory}/jmeter/logs. If you want another directory, you can specify where logs are saved using the <logsDirectory> tag.

E.g. : Set the log file in the results directory

<configuration>
    <logsDirectory>${project.build.directory}/jmeter/results</logsDirectory>
</configuration>