将 jmeter 依赖项添加到我的 pom.xml 时出现 log4j 错误 ERROR StatusLogger "No log4j2 configuration file found"
Gettting log4j error ERROR StatusLogger "No log4j2 configuration file found" while adding jmeter dependencies to my pom.xml
这是我的pom.xml。我收到 log4j 错误,收到错误后没有任何信息被打印出来,任何人都可以帮助解决这些问题。我见过很多类似的问题,但 none 个都很好
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.walmart.testframrework</groupId>
<artifactId>testframework</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_core</artifactId>
<version>4.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_jms</artifactId>
<version>4.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- <dependency>
<groupId>com.elega9t</groupId>
<artifactId>jmeter-jms-skip-jndi</artifactId>
<version>0.0.1</version>
</dependency> -->
<dependency>
<groupId>com.consol.citrus</groupId>
<artifactId>citrus-java-dsl</artifactId>
<version>2.7.3</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.consol.citrus/citrus-jms -->
<dependency>
<groupId>com.consol.citrus</groupId>
<artifactId>citrus-jms</artifactId>
<version>2.7.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.0.4.RELEASE</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.0.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.25</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.consol.citrus</groupId>
<artifactId>citrus-core</artifactId>
<version>2.7.3</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
在未添加 jmeter 依赖项之前,我的应用程序 运行 正常。但在添加这些依赖项后,它打印出
之类的错误
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console. Set system property 'log4j2.debug' to show Log4j2 internal initialization logging.
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file://dwshome-a.homeoffice.wal-mart.com/dwsuserdata$/avada2/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.10.0/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file://dwshome-a.homeoffice.wal-mart.com/dwsuserdata$/avada2/.m2/repository/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
这里是pom.xml
中定义的jmeter依赖
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_core</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_jms</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>com.elega9t</groupId>
<artifactId>jmeter-jms-skip-jndi</artifactId>
<version>0.0.1</version>
</dependency>
<maven_module>/src/test/resources
下有log4j2.xml
吗?
这是一个示例配置:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Properties>
<Property name="path">target</Property>
<Property name="logFileName">integration-tests-logs</Property>
<Property name="logPattern">%d{HH:mm:ss,SSS} %-5.5p %28.28c{2}| %m%n</Property>
</Properties>
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="${logPattern}"/>
</Console>
<File name="logfile" fileName="${path}/${logFileName}.log" append="true">
<PatternLayout pattern="${logPattern}"/>
</File>
</Appenders>
<Loggers>
<Root level="DEBUG">
<AppenderRef ref="console"/>
<AppenderRef ref="logfile"/>
</Root>
<Logger name="org.eclipse.jetty" level="INFO" additivity="false">
<AppenderRef ref="console"/>
</Logger>
</Loggers>
</Configuration>
这基本上是在控制台中配置日志记录,并在每次 运行 集成测试时在 /target
文件夹中生成一个日志文件。
这是我的pom.xml。我收到 log4j 错误,收到错误后没有任何信息被打印出来,任何人都可以帮助解决这些问题。我见过很多类似的问题,但 none 个都很好
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.walmart.testframrework</groupId>
<artifactId>testframework</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_core</artifactId>
<version>4.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_jms</artifactId>
<version>4.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- <dependency>
<groupId>com.elega9t</groupId>
<artifactId>jmeter-jms-skip-jndi</artifactId>
<version>0.0.1</version>
</dependency> -->
<dependency>
<groupId>com.consol.citrus</groupId>
<artifactId>citrus-java-dsl</artifactId>
<version>2.7.3</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.consol.citrus/citrus-jms -->
<dependency>
<groupId>com.consol.citrus</groupId>
<artifactId>citrus-jms</artifactId>
<version>2.7.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.0.4.RELEASE</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.0.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.25</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.consol.citrus</groupId>
<artifactId>citrus-core</artifactId>
<version>2.7.3</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
在未添加 jmeter 依赖项之前,我的应用程序 运行 正常。但在添加这些依赖项后,它打印出
之类的错误ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console. Set system property 'log4j2.debug' to show Log4j2 internal initialization logging.
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file://dwshome-a.homeoffice.wal-mart.com/dwsuserdata$/avada2/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.10.0/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file://dwshome-a.homeoffice.wal-mart.com/dwsuserdata$/avada2/.m2/repository/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
这里是pom.xml
中定义的jmeter依赖<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_core</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_jms</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>com.elega9t</groupId>
<artifactId>jmeter-jms-skip-jndi</artifactId>
<version>0.0.1</version>
</dependency>
<maven_module>/src/test/resources
下有log4j2.xml
吗?
这是一个示例配置:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Properties>
<Property name="path">target</Property>
<Property name="logFileName">integration-tests-logs</Property>
<Property name="logPattern">%d{HH:mm:ss,SSS} %-5.5p %28.28c{2}| %m%n</Property>
</Properties>
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="${logPattern}"/>
</Console>
<File name="logfile" fileName="${path}/${logFileName}.log" append="true">
<PatternLayout pattern="${logPattern}"/>
</File>
</Appenders>
<Loggers>
<Root level="DEBUG">
<AppenderRef ref="console"/>
<AppenderRef ref="logfile"/>
</Root>
<Logger name="org.eclipse.jetty" level="INFO" additivity="false">
<AppenderRef ref="console"/>
</Logger>
</Loggers>
</Configuration>
这基本上是在控制台中配置日志记录,并在每次 运行 集成测试时在 /target
文件夹中生成一个日志文件。