cancel
Showing results for 
Search instead for 
Did you mean: 

Automatic save log windows

Contributor

Automatic save log windows

It would be very nice when a log line in a log windows
also be written to a log file.

When debugging or testing a lot, the log window will erase lines
when there are more than n line's.

Raymond
9 REPLIES 9
Super Contributor

Re: Automatic save log windows

Hi Raymond,

this is actually possible currently by modifying the internal log4j configuration.. if you tell me which log you need I'll show you an example..

(obviously this should be improved to be configured directly in the UI in a future version)

regards!

/Ole
eviware.com
Contributor

Re: Automatic save log windows

Ole,

I want to export the groovy log  and some other log windows that
i self created.

It would be very nice when it can be configured directly in the UI by the future.

greetings,

raymond
Super Contributor

Re: Automatic save log windows

Hi,

ok.. I've attached a modified soapui-log4j.xml that you should save in your soapui-pro\bin directory, it adds the following to the standard configuration:

<logger name="groovy.log">
  <appender-ref ref="GroovyFile"/>
</logger>
 
<appender name="GroovyFile" class="org.apache.log4j.FileAppender">
    <errorHandler class="org.apache.log4j.helpers.OnlyOnceErrorHandler"/>
    <param name="File" value="soapui-groovy.log"/>
    <param name="Threshold" value="DEBUG"/>
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%d %-5p [%c{1}] %m%n"/>
    </layout>    
</appender>


ie it defines a file-appender which writes to a "soapui-groovy.log" file and associates it with the "groovy.log" category..

If you want to add appenders to your own logs, just create a category named as yours and appropriate appenders..

Hope this helps!

regards,

/Ole
eviware.com
Highlighted
Contributor

Re: Automatic save log windows

Thanks Ole,

I shall test this feature tomorrow.


greetings,

Raymond
Super Contributor

Re: Automatic save log windows

ok.. let me know if it works ok..

I've fixed an error in the attached file..

regards!

/Ole
eviware.com
Contributor

Re: Automatic save log windows

It works almost fine.

The file is OK
But i have 1 question.
In the log file is see
007-08-03 10:47:18,063 INFO  [category] testing..

How can i fill the [category] or skip this item.

I have attached the script, log and log4j.xml file.

Can you tell me what i do wrong, or forgot to do?


regards,

Raymond
Super Contributor

Re: Automatic save log windows

Hi Raymond,

the format is controlled by the ConversionPattern layout parameter in the config file.. if you change it to



then the category wont be displayed any more..

Hope this helps!

regards,

/Ole
eviware.com
Contributor

Re: Automatic save log windows

Ole,

Are the options for the ConversionPattern defined (described) somewhere ?

Raymond
Super Contributor

Re: Automatic save log windows

Hi Raymond,

yes.. have a look at

http://logging.apache.org/log4j/docs/ap ... ayout.html

regards!

/Ole
eviware.com
New Here?
Join us and watch the welcome video:
Top Kudoed Authors