Question

we have a pretty default apache2(2.2) with mod_jk(1.2.30) connected to a tomcat(6) all on the same host, no Loadbalancer and only 1 worker configured.

for debugging a specific issue i tried to increase the tomcat loglevel for the ajp connection.

i'm especially interessted in closing/opening the sockets, and the reasons for doing so.

However i am unable to find the correct logging parameter for this.

Looking through the tomcat-6.0-doc/api/ i was unable to find the correct class which is creating the socket.

closing the socket is possible for a few classes for what i hope i understood. logging.properties

handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

1catalina.org.apache.juli.FileHandler.level = FINEST
1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.

java.util.logging.ConsoleHandler.level = FINEST
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter

org.apache.catalina.core.AprLifecycleListener.level = ALL
org.apache.catalina.connector.level = FINEST
org.apache.coyote.level = FINEST
org.apache.tomcat.util.net.AprEndpoint. = FINEST
org.apache.tomcat.level = FINEST
org.apache.tomcat.jni.Socket = FINEST

server.xml important parts:

<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener className="org.apache.catalina.core.JasperListener" />
<!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" address="localhost" />
<Listener className="org.apache.jk.config.ApacheConfig" modJk="/usr/lib/apache2/modules/mod_jk.so" />

mod_jk workers.properties

worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009

worker.worker1.connection_pool_size=1

so my question(s):

how can i get the socket creation/closing to beeing logged ? what is the name of the class i need to log for this?

Or do i need Valgrind or similar tools for this already?

The reason i need this (just for completion)

on our Test Environment we have about 1% of the requests coming from a standard browser resulting in 502 bad gateway or 503 service temporarily unavailable http status codes.

Mod_jk trace logs do show wrong_message_format, but for all we can tell the wireshark logs and the ajp data is valid.

The Error is reproduce-able , just not exactly on 1 specific request. if i do 200 parallel requests (read only) im able to trigger the error at least twice.

Thanks in advance

Was it helpful?

Solution

neither java.net.socket nor the jni.socket implementation org.apache.tomcat.jni.Socket do log "normally", even with setting loglevel to finest. There is simple no code for logging. The only thing what can happen is in case of an error there is an exception.

However one can trace the corresponding class with jconsole and/or jVisualVM.

for us the java.net.socket is the class we need for further debugging our issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top