Forum Discussion

kassen's avatar
12 years ago

SoapUI overwrites and closes log4j settings

Hi
I'm running JBehave tests including sending request via SoapUI (4.5.1).
I experience a problem with SoapUI classes overwriting my log4j settings and finally closing all appender so that my subsequent log calls don't get printed to output.

Has anyone out there experienced and/or solved the same?

Best regards,
Christian

6 Replies

  • boly38's avatar
    boly38
    New Contributor
    Hi all,
    I just register on this forum to add a reply to this post

    thanks redfish4ktc2 for your tip ! this help me.


    I had exactly the same problem: while using SoapUITestCaseRunner or WsdlProject,
    => SoapUI Logger take the hand on Log4j configuration, and I loose my log4j output and related console output...


    After a SoapUI run() call, any logs are only keeped in the "soapui.log" file.
    (following //soapui-4.5.1.jar:/com/eviware/soapui/resources/conf/soapui-log4j.xml configuration);


    For my project, I'm using a "log4j.properties" file and not an xml one.
    I found a workaround to keep (ONLY) my own log4j configuration by setting an empty log4j xml config file for soapUI.

    It would be great to update soapui to add a toggle flag to do this for me :
    - for example : "soapui.log4j.keepcurrentconfig" (true|false) system property [default:false]
    => if set to true, then soapui doesn't overrite the current log4j configuration
    (I'm not sure about the flag's name )


    workaround example :

    System.setProperty("soapui.log4j.config","target/test-classes/soapui-log4j.xml");
    LOG.info("play wsdl SoapUI Project :" +soapUiResource);
    SoapUITestCaseRunner runner = new SoapUITestCaseRunner();
    runner.setProjectFile(soapUiResource);
    runner.setPrintReport(true);
    runner.setOutputFolder("target/");
    runner.runRunner();
    LOG.info("my log after a run() or runRunner() call..");


    an empty soapui-log4j.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
    <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
    </log4j:configuration>


    regards
  • redfish4ktc2's avatar
    redfish4ktc2
    Super Contributor
    force soapui to use your log4j configuration file by setting the "soapui.log4j.config" system property to the path to your log4j file
  • redfish4ktc2's avatar
    redfish4ktc2
    Super Contributor
    nice if my tip helps!
    if your log4j propertes file is available in a directory, you can directly tell soapui to use it with something like
    System.setProperty("soapui.log4j.config","path/to/your/log4j.properties");
  • boly38's avatar
    boly38
    New Contributor
    I had sax errors while using "log4j.properties" as value
    Regards
    • gsfurtado's avatar
      gsfurtado
      Occasional Contributor

      Hi guy's.

       

      This solution didn't work for me. I can't understand why.

      SoapUi v 5.2.1.

       

      One thing that i noticed is that when i run the following groovy before running my own plugin the "soapui.log4j.config" property isn't there.

       

      x = System.getProperties();
      log.info(x.toString());