Pivotal Knowledge Base

Follow

How to prevent Tomcat log from redirecting into Gemfire log

Applies To:

Gemfire 7.0.0.x to 7.0.2.x

Purpose:

This document describes one way to prevent Tomcat logging from redirecting into the GemFire log.

Symptom:

When starting a maven-based web application that integrates a GemFire Peer from within a Tomcat container, the maven summary output may be caught by the GemFire log instead of showing in the console.

For instance:

When running the maven command [mvn clean install] on a web application using Spring Data GemFire, the following summary output will be redirected into the GemFire log.

------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.sample.class1
Tests run: 10, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 24.053 sec - in com.sample.class1
Running com.sample.class2
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.487 sec - in com.sample.class2

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Core / Sample / JavaClass ........................ SUCCESS [ 0.285 s]
[INFO] sampleProjects ................................... SUCCESS [ 0.725 s]
[INFO] sampleData-client ................................ SUCCESS [ 2.302 s]
[INFO] sample1-client ................................... SUCCESS [ 2.033 s]
[INFO] sample2-client ................................... SUCCESS [ 0.404 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:31 min
[INFO] Finished at: 2014-08-12T10:59:52-07:00
[INFO] Final Memory: 241M/649M
[INFO] ------------------------------------------------------------------------

Root Cause:

By default, GemFire will redirect Stdout/Stderr into the GemFire log.

Solution:

To prevent Tomcat logging (or Stdout/Stderr) from redirecting into the Gemfire log, you can disable this output redirection by setting the system property "GemFire.OSProcess.DISABLE_OUTPUT_REDIRECTION" to true, i.e. set:

-DGemFire.OSProcess.DISABLE_OUTPUT_REDIRECTION=true

Alternately, if you start the GemFire peer using the Tomcat container plugin within a maven project, you can add this system property using the "systemProperties" element in the tomcat plugin section, e.g.:

<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<port>8080</port>
<url>http://localhost:8080/manager</url>
<update>true</update>
<systemProperties>
<GemFire.OSProcess.DISABLE_OUTPUT_REDIRECTION>true</GemFire.OSProcess.DISABLE_OUTPUT_REDIRECTION>
</systemProperties>
</configuration>

Comments

Powered by Zendesk