0

我有一个soapUI 4.5.2 项目,我使用Maven 3.0.5 通过IntelliJ 12 运行。这实际上很好用。所有测试都已运行,并且我将我的 pom 文件配置为将日志文件准确地写入我想要的位置。我遇到的问题是这个。soapUI 正在向控制台写入大量数据,我似乎无法将其恢复。我尝试了自己的 log4j 设置:

# Print info for the root logger
log4j.rootLogger=ERROR, stdout
log4j.logger.httpclient.wire.header=ERROR
log4j.logger.httpclient.wire.content=ERROR
log4j.logger.org.apache.commons.httpclient=ERROR
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

# Print the date in ISO 8601 format
log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n

但是soapUI / Maven 仍然会向控制台生成调试输出。例如:

09:47:44,096 调试 [SoapUIMultiThreadedHttpConnectionManager$SoapUIDefaultClientConnection] 发送请求:PUT /template/xyz/ HTTP/1.1 09:47:44,722 调试 [SoapUIMultiThreadedHttpConnectionManager$SoapUIDefaultClientConnection] 接收响应:HTTP/1.1 200 OK 09:47:44,732 调试 [SoapUIMultiThreadedHttpConnectionManager $SoapUIDefaultClientConnection] 连接关闭

我已经编辑了soapui-log4j.xml 文件以仅打印错误,但这无济于事。可能是我有正确的编辑,但我不知道如何告诉 Maven/soapUI 使用 IntellIj 中我的 pom 文件中的这个文件。关于如何停止所有控制台输出的任何想法?

这是我的pom文件:

<groupId>com.xyz.soapui</groupId>
<artifactId>apitesting</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>

<name>apitesting</name>
<url>http://maven.apache.org</url>

<prerequisites>
    <maven>3.0.5</maven>
</prerequisites>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>
</dependencies>

<pluginRepositories>
    <pluginRepository>
        <id>eviwarePluginRepository</id>
        <url>http://www.eviware.com/repository/maven2/</url>
    </pluginRepository>
    <pluginRepository>
        <id>mvnPluginRepository</id>
        <url>http://mirrors.ibiblio.org/pub/mirrors/maven/mule/dependencies/maven2/</url>
    </pluginRepository>
    <pluginRepository>
        <id>codehausPluginRepository</id>
        <url>https://nexus.codehaus.org/content/groups/snapshots-group/org/codehaus/mojo/</url>
    </pluginRepository>
</pluginRepositories>

<build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>com.github.redfish4ktc.soapui</groupId>
            <artifactId>maven-soapui-extension-plugin</artifactId>
            <version>4.5.1.4</version>
            <dependencies>
                <dependency>
                    <groupId>postgresql</groupId>
                    <artifactId>postgresql</artifactId>
                    <version>9.1-901.jdbc4</version>
                </dependency>
                <dependency>
                    <groupId>com.jgoodies</groupId>
                    <artifactId>looks</artifactId>
                    <version>2.2.2</version>
                </dependency>
                <dependency>
                    <groupId>com.fifesoft</groupId>
                    <artifactId>rsyntaxtextarea</artifactId>
                    <version>2.0.7</version>
                </dependency>
            </dependencies>
            <configuration>
                <runnerType>PRO</runnerType>
                <projectFile>${basedir}/src/test/resources/apitesting-soapui-project.xml</projectFile>
                <outputFolder>${project.build.directory}/soapui-reports</outputFolder>
                <exportAll>true</exportAll>
                <reportFormat>HTML</reportFormat>
                <coverage>false</coverage>
                <printReport>true</printReport>
                <junitReport>true</junitReport>
                <testFailIgnore>true</testFailIgnore>
                <settingsFile>/home/xyz/soapui-settings.xml</settingsFile>
                <projectProperties>
                    <value>pmessage=Project Property</value>
                </projectProperties>
                <globalProperties>
                    <value>gmessage=Global Property</value>
                </globalProperties>
                <soapuiProperties>
                    <property>
                        <name>soapui.logroot</name>
                        <value>${project.build.directory}/soapui-logs/</value>
                    </property>
                </soapuiProperties>
                <inputProject/>
                <outputProject/>
            </configuration>
        </plugin>
    </plugins>
</build>

谢谢!

4

1 回答 1

1

根据插件文档,您可以覆盖soapUI 的 log4j 配置:

您还可以通过在项目基目录中提供“soapui-log4j.xml”文件来覆盖默认日志配置。这适用于 smartbear 插件(开源和专业版)和 maven-soapui-extension-plugin。

所以一定要使用正确的文件名、位置和格式(xml ......但它也可能适用于“soapui-log4j.properties”:我没有尝试)

于 2013-08-28T16:03:56.147 回答