Forum Discussion
omatzura
18 years agoSuper Contributor
Hi!
sure.. you can loop the elements in the model we accessed in the previous script and write them to a file:
if you want to make it really fancy you can prompt for the file:
regards!
/Ole
sure.. you can loop the elements in the model we accessed in the previous script and write them to a file:
def logArea = com.eviware.soapui.SoapUI.logMonitor
if( logArea != null )
{
def ix = logArea.indexOfTab( "http log" );
if( ix >= 0 )
{
def logPanel = logArea.getComponentAt( ix )
def model = logPanel.logList.model
if( model.size > 0 )
{
def out = new java.io.PrintWriter( "myfile.log" )
for( c in 0..(model.size-1) )
out.println( model.getElementAt( c ))
out.close()
}
}
}
if you want to make it really fancy you can prompt for the file:
def logArea = com.eviware.soapui.SoapUI.logMonitor
if( logArea != null )
{
def ix = logArea.indexOfTab( "http log" );
if( ix >= 0 )
{
def logPanel = logArea.getComponentAt( ix )
def model = logPanel.logList.model
if( model.size > 0 )
{
def file = com.eviware.soapui.support.UISupport.fileDialogs.saveAs(
null, "Export Log", "*.log", "*.log", null )
if( file != null )
{
def out = new java.io.PrintWriter( file )
for( c in 0..(model.size-1) )
out.println( model.getElementAt( c ))
out.close()
}
}
}
}
regards!
/Ole