0

Tomcat logges in eclipse everything starting with DEBUG. It doesn't log only its own properties but other stuff allow themselves to log (like:

[localhost-startStop-1] DEBUG o.s.w.c.s.StandardServletEnvironment or
[localhost-startStop-1] DEBUG o.s.c.i.s.PathMatchingResourcePatternResolver and many many others).

I want to limit tomcat logging to info or warning. I tried going into the tomcat directory and changing the log level in logging.propertie from "FINE" to "INFO" to no avail. I even tried to copy the file into eclipse and appending -Djava.util.logging.config.file=$/Servers/Tomcat v7.0 Server at localhost-config/logging.properties} -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager but that didn't help either (and of course I cleaned tomcat many times).

Also, in web.xml the only place I have the word 'log' not in comment is

<mime-mapping>
        <extension>gph</extension>
        <mime-type>application/vnd.flographit</mime-type>
</mime-mapping>

and

<mime-mapping>
        <extension>log</extension>
        <mime-type>text/plain</mime-type>
</mime-mapping>

and my log4j.xml files are configured with either INFO or WARNING, not DEBUG.

How can I limit the log to INFO or WARNING, or even just disallow unnecessary classes to log?

Pramod Karandikar
  • 5,289
  • 7
  • 43
  • 68
Ran
  • 657
  • 2
  • 13
  • 29

1 Answers1

1

Tomcat uses Juli logging framework, a mix of Java Util Logging and Apache Commons Logging. You can either set the level in the JRE, youre Eclipse is running with ([JRE_DIR]/lib/logging.properties), or you can define your own one, i.e. copy the former into the Tomcat directory and add this to the run configuration:

Eclipse: "Run" -> "Run Configurations" -> select Tomcat to the left -> select tab "Arguments" to the right -> add this to "VM Arguments":

-Djava.util.logging.config.file=[PATH_TO TOMCAT]\lib\logging.properties

In that file, change these lines:

.level=INFO

java.util.logging.ConsoleHandler.level = WARNING

Thats it.

Stefan
  • 12,108
  • 5
  • 47
  • 66
  • No good. [JRE_DIR]/lib/logging.properties was already configured with 'INFO', so I did what you told me ('Run -> 'Run Configurations'...) and no good came of it either, – Ran Jan 22 '15 at 07:59