Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat 7 logging still emits FINE and FINER logging, despite INFO being set everywhere

Tags:

java

tomcat

I'm trying to quell the ridiculous amount of logging Tomcat 7 emits out of the box.

For every single request, I get this amount of logging:

FINE: Security checking request POST /myurl
Aug 28, 2015 7:17:08 AM org.apache.catalina.authenticator.AuthenticatorBase invoke
FINE:  Not subject to any constraint
Aug 28, 2015 7:17:08 AM org.apache.catalina.core.StandardWrapper allocate
FINER:   Returning non-STM instance
Aug 28, 2015 7:17:08 AM org.apache.catalina.authenticator.AuthenticatorBase invoke

I have set my $CATALINA_HOME/conf/logging.properties to this, to no avail.

(I basically took the default logging properties, and switched everything to info. Also added org.apache.catalina.level = INFO)

handlers = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.FileHandler, 3manager.org.apache.juli.FileHandler, 4host-manager.org.apache.juli.
FileHandler, java.util.logging.ConsoleHandler

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

org.apache.catalina.level = INFO


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

2localhost.org.apache.juli.FileHandler.level = INFO
2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
2localhost.org.apache.juli.FileHandler.prefix = localhost.

3manager.org.apache.juli.FileHandler.level = INFO
3manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
3manager.org.apache.juli.FileHandler.prefix = manager.

4host-manager.org.apache.juli.FileHandler.level = INFO
4host-manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
4host-manager.org.apache.juli.FileHandler.prefix = host-manager.

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

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.FileHandler

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.apache.juli.FileHandler

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = 4host-manager.org.apache.juli.FileHandler

# For example, set the org.apache.catalina.util.LifecycleBase logger to log
# each component that extends LifecycleBase changing state:
#org.apache.catalina.util.LifecycleBase.level = INFO

# To see debug messages in TldLocationsCache, uncomment the following line:
#org.apache.jasper.compiler.TldLocationsCache.level = INFO

Still I get FINE and FINER log messages.

edit: more info. I'm using tomcat inside of docker, this particular image.

It is a very simple installation, no split base or anything:

ENV CATALINA_HOME /usr/local/tomcat
ENV PATH $CATALINA_HOME/bin:$PATH
RUN mkdir -p "$CATALINA_HOME"
WORKDIR $CATALINA_HOME

update

I switched to the log4j logger as explained here and here. (one small error in the first link - tomcat-juli-adapter.jar goes in lib/, not bin/). That solved my problem, but not with the out-of-the-box tomcat logger. I'll leave the question up, though.

like image 753
adapt-dev Avatar asked Aug 28 '15 17:08

adapt-dev


People also ask

What is Juli in Tomcat?

Apache Tomcat has its own implementation of several key elements of java. util. logging API. This implementation is called JULI. The key component there is a custom LogManager implementation, that is aware of different web applications running on Tomcat (and their different class loaders).


1 Answers

Did you set the logging file property (java.util.logging.config.file) as specified in Tomcat docs? Excerpt below

...logging can be configured at the following layers:

  • Globally. That is usually done in the ${catalina.base}/conf/logging.properties file. The file is specified by the java.util.logging.config.file System property which is set by the startup scripts. If it is not readable or is not configured, the default is to use the ${java.home}/lib/logging.properties file in the JRE.
  • In the web application. The file will be WEB-INF/classes/logging.properties
like image 148
Ravi Avatar answered Oct 14 '22 09:10

Ravi