Book Image

SoapUI Cookbook

By : Rupert Anderson
Book Image

SoapUI Cookbook

By: Rupert Anderson

Overview of this book

Table of Contents (19 chapters)
SoapUI Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Logging from extensions and scripts


In your extensions you will often need to log messages for info, debug and errors. This recipe provides a brief overview on how log messages to the soapui.log file, soapui log tab and groovy log tab.

Getting ready

To illustrate the logging approaches we'll add examples to a custom Action plugin based on the soapui-sample-plugin Gradle project from the previous recipe. You can find this in the plugins/soapui-logging-plugin folder of the chapter 11 samples.

How to do it...

Let's take a look at an example of each of the logging types. Here is the custom Action that will do the logging for us:

import org.apache.log4j.Logger
import com.eviware.soapui.SoapUI
import com.eviware.soapui.impl.wsdl.WsdlProject
import com.eviware.soapui.support.action.support.AbstractSoapUIAction

public class LoggingProjectAction extends AbstractSoapUIAction<WsdlProject>{

  protected final Logger soapuiLogFileLogger = Logger.getLogger(getClass())
  protected final Logger scriptLogger...