Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Limiting and Rolling Virtualize Logs

Ramiro Martinez
Ramiro Martinez Posts: 53 admin
edited March 2020 in Virtualize

This forum post will go over the process for creating, limiting, and rolling logs for the Virtualize WAR installation. The purpose of these changes is to avoid the issue of running out of HDD space.
1. Configuring a Virtualize logging configuration file with file output
2. Configuring a Virtualize logging configuration file with minimized console output
3. Tomcat Service installation only: Disabling stdout and stderror

More information will be added to this forum post in the near future, next update will add a section 4, which will go over Rolling and limiting Catalina and other Tomcat logs

Section 1: Configuring a Virtualize logging configuration file with file output
With the default logging configurations, the majority of the Virtualize logging is sent to the console, which is either lost after the server is shutdown or if you start Tomcat as a service, they are saved in the stdout and stderror files. This can lead to stdout and stderror files that are much too large and fill space on the HDD.

Step 1: Find the WEB_INF folder within SOAVirt
A) If you installed SOAVIRT outside of the Tomcat by modifying the ROOT.xml (Method 1 in the installation guide): Using the File Explorer, open the ${SOAVIRT_HOME}>WEB_INF
B ) If you installed SOAVIRT within the Tomcat folder (Method 2 in the installation guide): Using the File Explorer, open the ${Tomcat_Installation_Folder}>webapps>ROOT>WEB_INF

Step 2: Adding a new logging config file
Either download and place the attached rolling_logs.logging.xml file into the WEB_INF folder or create a copy of the file: default.logging and rename the copy to something else. I will be using the name rolling_logs.logging(.xml) for the rest of this guide.

The rolling_logs.logging.xml file has been preconfigured with the modifications needed to enable rolling of the logs when they reach 10mb and has a limit of 10 backlogs.

The rolling_logs.txt requires a renaming. Change the name from rolling_logs.txt to rolling_logs.logging.xml. Be sure to change the extension.

Note: If you do not display common file extensions the files will look like this in the file explorer default.logging but these files do have a .xml extension and the actual full name is default.logging.xml or rolling_logs.logging.xml which will be important in step 5 of section 1

Step 3: Modifying the file
(If you are using the downloaded file, steps 3 and the entirety of section 2 can be skipped. The modifications have already been completed. If you want different configurations for your logging, see step 4 of this section)
Open the rolling_logs.logging.xml file using a file editor. Make the following modifications
After the “appender” element for CONSOLE Add the following XML:
<appender name="file" class="org.apache.log4j.RollingFileAppender"> <param name="append" value="true" /> <param name="maxFileSize" value="10MB" /> <param name="maxBackupIndex" value="10" /> <param name="Threshold" value="INFO" /> <param name="file" value="C:/Logs/virtualize.log" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="[%p] %d [%t] %m at %l%n" /> </layout> </appender>

Add the following line to the “category” elements of “com.parasoft”, “com.parasoft.stub.lic”, and “com.parasoft.webtool.tomcat”
<appender-ref ref="file" />

Step 4: Summary of the rolling and limiting properties
With this we have created a logging properties file that will create a file with the same SOAVIRT information that was being sent to the Console, but now we have control over it. The form of control that we have, is configured with the following lines:

<param name="maxFileSize" value="10MB" />: This line defines the maximum size of the Virtualize log file before it is rotated into a backlog file. If you wanted to make the max size into 25MB it would like this:
<param name="maxFileSize" value="25MB" />

<param name="maxBackupIndex" value="10" />: This line defines the maximum number of backlog files. When the 11th backlog file would be created, the oldest backlog file is deleted, and a newer backlog file takes the place. If you wanted to make the max number of backlogs 125, it would like this:
<param name="maxBackupIndex" value="125" />

<param name="file" value="C:/Logs/virtualize.log" />: This line defines the name and location of the SOAVIRT log and backlogs. In the example property file, the files are stored on the C drive in a folder named Logs and named virtualize.log. The backlogs are named “virtualize.log.#”

Step 5: Enabling the rolling_logs.logging.xml file
Before making changes to the file, be sure to Shut down the Virtualize server
Within the same WEB_INF folder where we found the default.logging xml file, open the file with a text editor such as Notepad++.
In the, there is a property for “logging.config.file=”; it may or may not be commented out depending on what has been configured previously.
A) Add a new line after the property and copy the property line “logging.config.file=” into the new blank line
B ) If the property was previously commented out with a # in the front, remove it.
C) Change the value to point to your new logging configuration file.
D) Make certain to comment out the original line, if it was not already commented out. To do this, prepend a # to the property line


Section 2: Configuring a SOAVIRT logging configuration file with minimized console output (Skip if using the attached rolling_logs.logging.xml file)

Step 1: Modifying the console appender
Open the rolling_logs.logging.xml
In the Console “appender” element change the following line:
<param name="Threshold" value="INFO"/> to <param name="Threshold" value="OFF"/>


Step 2: Delete the appender-ref elements for console
Delete following line from the “category” elements of “com.parasoft”, “com.parasoft.stub.lic”, and “com.parasoft.webtool.tomcat”
<appender-ref ref="console" />

These changes reduce the amount of data sent to the console from SOAVIRT to nothing; this data is instead sent to the Virtualize log file that is being generated by the changes made in section 1. This way we can drastically reduce the size of the stdout and stderror files to be much smaller. Additionally, in section 3 we will discuss eliminating the files, since the same information is kept in the Catalina and the rest of the logs in the Tomcat logs folder.

Section 3: (Optional for minimizing logging) Tomcat Service installation only: Disabling stdout and stderror
Step 1:
In the File Explorer, visit ${Tomcat_Installation_Folder)>bin, and start Tomcat8w, the number depends on the version of Tomcat you are using.

Step 2: Switch to the “Logging” tab

Step 3: Remove the values in the text boxes for “Redirect Stdout” and “Redirect Stderror”
Step 4: Click Apply