Forum Discussion

gopiharan79's avatar
gopiharan79
Occasional Contributor
12 years ago

Logs not printed when war deployed in Tomcat

Hi,
The log.info statements we give in our groovy code is getting printed in soapui and when we run the maven test cases command line. Log files like global-groovy.log, soapui.log, soapui-errors.log are getting generated in soapui and the project location where maven build is executed.
However, when we create war from soapui and deploy in tomcat-linux container, not able to see these logs printed in console or getting generated in the tomcat workspace.

Can someone guide me how to enable the logging in tomcat container for these groovy logs?

Thanks,
Gopi.
  • redfish4ktc2's avatar
    redfish4ktc2
    Super Contributor
    Hi
    The log.info statements we give in our groovy code

    the groovy code is in a mockservice / mockresponses elements?
    Do you see other soapui logs in the tomcat log file? you should see something like this
    Sep 18, 2013 7:49:43 PM com.eviware.soapui.mockaswar.MockAsWarProServlet initMockServiceParameters INFO: Scripts dir not set!
    Sep 18, 2013 7:49:43 PM com.eviware.soapui.mockaswar.MockAsWarServlet initMockServiceParameters INFO: Listeners not set!
    Sep 18, 2013 7:49:43 PM com.eviware.soapui.mockaswar.MockAsWarServlet initMockServiceParameters INFO: Actions not set!
    Sep 18, 2013 7:49:43 PM com.eviware.soapui.mockaswar.MockAsWarServlet initMockServiceParameters INFO: SoapUI core already exists, reusing existing one
    Sep 18, 2013 7:49:43 PM com.eviware.soapui.mockaswar.MockAsWarServlet initMockServiceParameters INFO: WebUI ENABLED
    [INFO] Sep 18, 2013 7:49:43 PM com.eviware.soapui.mockaswar.MockAsWarServlet init INFO: Loading project


    About your problem, this seems related to the soapui default loj4j configuration file which is used by the generated war. By default, groovy logs are not displayed in the standard output .See https://github.com/SmartBear/soapui/blo ... -log4j.xml

    When using maven or the command line tool, you run a SoapUIMockServiceRunner instance. In this case, the groovy logs are displayed in the standard output because the runner explicitly ensure it (see https://github.com/SmartBear/soapui/blo ... r.java#L68)

    This is not the case when running the mock in the war. See https://github.com/SmartBear/soapui/blo ... .java#L168


    You can try the following
    Define your own log4j config file and add -Dsoapui.log4j.config=<path_to_your_log4j_file> to the tomcat startup script
    or add a -Dsoapui.logroot=<path_to_logs_dir>

    Also remember that if you enable the webUI, you can this groovy log in the web page