Forum Discussion

JanPot's avatar
JanPot
Occasional Contributor
2 years ago

set soapUI 5.7.0 log files using maven

We recently switch version of soapUI from 5.5.0 to 5.7.0 for running automated scripts using maven.

With 5.5.0, we could find the soapUI log files (soapui-errors.log, global-groovy.log and soapui.log) in the same folder where the tests were run.

Now with 5.7.0, those files are created under the "C:\Users\[username]\.soapuios\logs"

This is really not what we want, we have many scripts running in parallel and those logs can sometimes be really hard to read.

We tried this solution in the maven pom file, but it does not seems to work:

...

<properties>
    <thx.environment>AWSQA</thx.environment>
    <project.directory>QA/soapui/thxqa-sts/</project.directory>
</properties>

<build>
<plugins>

<plugin>
    <groupId>com.smartbear.soapui</groupId>
    <artifactId>soapui-maven-plugin</artifactId>
    <version>5.7.0</version>
    <configuration>
        <junitReport>true</junitReport>
        <exportAll>true</exportAll>
       <testFailIgnore>true</testFailIgnore>
       <soapuiProperties>
           <property>
               <name>soapui.logroot</name>
               <value>${project.directory}/soapui-logs/</value>
           </property>
       </soapuiProperties>
    </configuration>

...

 

Anyone has a way to set back the log files like they were with soapui-maven 5.5.0 ?

  • Thanks to JHunt and nmrao,

    I finally found a solution, with the help of those 2 persons:

    1- Copied the soapui-log4j.xml for SoapUI 5.7.0 GUI to a folder of my choice.

    2- Added 2 parameters to the maven call:

    -Dsoapui.logroot=results

    -Dsoapui.log4j.config=ext/soapui-log4j.xml

    So now it takes the correct log4j and the logs are placed in the results folder.

  • JHunt's avatar
    JHunt
    Community Hero

    In SoapUI 5.5.0, logging was with log4j version 1. That release doesn't have a tag in the repository, but the log4j configuration didn't change for 5.6.0, so you can find that configuration here: (github)

     

    SoapUI 5.7.0 uses log4j2 (github), and while log4j2 has a different configuration file format, it should also support the log4j 1 configuration files (apache.org).

     

    Download the original configuration and either:

    • replace the soapui-log4j.xml in your installation directory with it, or
    • save it separately and set the SoapUI property:

     

    soapui.log4j.config="<path-to-file>"

     

    • JanPot's avatar
      JanPot
      Occasional Contributor

      @JHunt,

      Thanks, I will try that, I'm just wondering, since the VM on which soapUI is run from maven doesn't have SoapUI installed, should I create the soapui-log4j.xml file in a 'fake' %SOAPUI_HOME%/bin ?  

  • nmrao's avatar
    nmrao
    Champion Level 3

    JanPot

     

    soapui-log4j.xml is available under %SOAPUI_HOME%/bin directory and it has the path which you mentioned i.e.,  "C:\Users\[username]\.soapuios\logs"

    Earlier, soapui-log4j.xml was using soapui.logroot property and now that property is no more used, so you are noticing the difference in the behaviour.

     

    You can simply modify the path wherever you want.

    For example, you can update soapui-log4j.xml as below:

     

    Search for string ${sys:user.home}/.soapuios/logs/ and replace all with ${sys:soapui.logroot}/.

    And save the soapui-log4j.xml file.

     

    Now, it will look like below:

     

    <RollingFile name="FILE"
    fileName
    ="${sys:soapui.logroot}/soapui.log" 
    filepattern="${sys:soapui.logroot}/soapui.log%i"  

     

    You do not have to make any change in the pom.xml, and it should work as it used to for you.

     

    NOTE: Have a backup the original soapui-log4j.xml before making the above said modifications if in case need to revert or other issues arise.

    • JanPot's avatar
      JanPot
      Occasional Contributor

      nmrao,

      Thanks, I will try that, I'm just wondering, since the VM on which soapUI is run from maven doesn't have SoapUI installed, should I create the soapui-log4j.xml file in a 'fake' %SOAPUI_HOME%/bin ?  

  • nmrao's avatar
    nmrao
    Champion Level 3

    Oh I did not realize it.

     

    I think, JHunt already put that in his answer.

  • JanPot's avatar
    JanPot
    Occasional Contributor

    Thanks to JHunt and nmrao,

    I finally found a solution, with the help of those 2 persons:

    1- Copied the soapui-log4j.xml for SoapUI 5.7.0 GUI to a folder of my choice.

    2- Added 2 parameters to the maven call:

    -Dsoapui.logroot=results

    -Dsoapui.log4j.config=ext/soapui-log4j.xml

    So now it takes the correct log4j and the logs are placed in the results folder.