Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Customize the java.util.logging.ConsoleHandler.formatter Tomcat 6

I would like to change the Formatter for the handler 1catalina.org.apache.juli.FileHandler on my Tomcat 6.0.36.

I've done these steps:

  1. Created a new Java Project in Eclise
  2. Created a new class extending Formatter
  3. Exported project as jar
  4. Copied the jar in CATALINA_BASE/lib
  5. Edited the file CATALINA_BASE/conf/logging.properties to add this line: 1catalina.org.apache.juli.FileHandler.formatter = com.mycompany.myformatter

But it actually not working, I mean it always use the SimpleFormatter.

I use a fresh downloaded apache-tomcat bundle.

Any Idea?

Thanks!

like image 666
FloFu Avatar asked Dec 04 '25 14:12

FloFu


1 Answers

Actually, the library, where the formatter is, should be included in the Tomcat Classpath. That not only mean "Copy the jar in CATALINA_BASE/lib", it means also: add it to the CLASSPATH variable.

Example:

$ cat bin/setenv.sh
[...]
CLASSPATH="$CATALINA_BASE"/lib/myformatter.jar
export CLASSPATH
like image 152
FloFu Avatar answered Dec 07 '25 03:12

FloFu