You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2003/04/25 11:39:14 UTC
DO NOT REPLY [Bug 19312] New: -
Bug in log() of StandardWrapperValve.java in Tomcat 4.1.24
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19312>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19312
Bug in log() of StandardWrapperValve.java in Tomcat 4.1.24
Summary: Bug in log() of StandardWrapperValve.java in Tomcat
4.1.24
Product: Tomcat 4
Version: 4.1.24
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: Other
Component: Catalina
AssignedTo: tomcat-dev@jakarta.apache.org
ReportedBy: jonas.anden@aptilo.com
I found a bug causing an OutOfMemoryError when attempting to log an exception
that in StandardWrapperValve.
<code>
/**
* Log a message on the Logger associated with our Container (if any)
*
* @param message Message to be logged
* @param throwable Associated exception
*/
private void log(String message, Throwable throwable) {
Logger logger = null;
if (container != null)
logger = container.getLogger();
if (logger != null)
logger.log("StandardWrapperValve[" + container.getName() + "]: "
+ message, throwable);
else {
String containerName = null;
if (container != null)
containerName = container.getName();
log( "StandardWrapperValve[" + containerName
+ "]: " + message, throwable);
}
}
</code>
In the above code, if container.getLogger() returns null (meaning no logger is
connected to this valve), the result will be recursive calling until the VM
throws OutOfMemoryError.
Suggested fix (as implemented in the non-exception variant of log and other
classes in Tomcat):
<code>
/**
* Log a message on the Logger associated with our Container (if any)
*
* @param message Message to be logged
* @param throwable Associated exception
*/
private void log(String message, Throwable throwable) {
Logger logger = null;
if (container != null)
logger = container.getLogger();
if (logger != null)
logger.log("StandardWrapperValve[" + container.getName() + "]: "
+ message, throwable);
else {
String containerName = null;
if (container != null)
containerName = container.getName();
- log( "StandardWrapperValve[" + containerName
- + "]: " + message, throwable);
+ System.out.println( "StandardWrapperValve[" + containerName
+ + "]: " + message );
+ throwable.printStackTrace(System.out);
}
}
</code>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org