Configure Log4j logger with Tomcat 6

By default tomcat uses "java.util.logging" for all internal logging in tomcat. If you want to use log4j with tomcat for logging then follow below steps.
So before we start lets remove tomcat's default java.util.logging configuration and add log4j.

You will have to download log4j jar file from here. Apart from log4j jar file you need to get tomcat-juli.jar and tomcat-juli-adapters.jar files from this location according to your tomcat version.

So after downloading log4j jar, tomcat-juli.jar and tomcat-juli-adapters.jar files follow below steps.
1. Copy tomcat-juli-adapters.jar file into tomcat/lib folder.
2. Create log4j.properties file in tomcat/lib folder with below content.

log4j.rootLogger=INFO, CATALINA
# Define all the appenders
log4j.appender.CATALINA=org.apache.log4j.DailyRollingFileAppender
log4j.appender.CATALINA.File=${catalina.base}/logs/catalina.
log4j.appender.CATALINA.Append=true
log4j.appender.CATALINA.Encoding=UTF-8
# Roll-over the log once per day
log4j.appender.CATALINA.DatePattern='.'yyyy-MM-dd'.log'
log4j.appender.CATALINA.layout = org.apache.log4j.PatternLayout
log4j.appender.CATALINA.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
log4j.appender.LOCALHOST=org.apache.log4j.DailyRollingFileAppender
log4j.appender.LOCALHOST.File=${catalina.base}/logs/localhost.
log4j.appender.LOCALHOST.Append=true
log4j.appender.LOCALHOST.Encoding=UTF-8
log4j.appender.LOCALHOST.DatePattern='.'yyyy-MM-dd'.log'
log4j.appender.LOCALHOST.layout = org.apache.log4j.PatternLayout
log4j.appender.LOCALHOST.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
log4j.appender.MANAGER=org.apache.log4j.DailyRollingFileAppender
log4j.appender.MANAGER.File=${catalina.base}/logs/manager.
log4j.appender.MANAGER.Append=true
log4j.appender.MANAGER.Encoding=UTF-8
log4j.appender.MANAGER.DatePattern='.'yyyy-MM-dd'.log'
log4j.appender.MANAGER.layout = org.apache.log4j.PatternLayout
log4j.appender.MANAGER.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
log4j.appender.HOST-MANAGER=org.apache.log4j.DailyRollingFileAppender
log4j.appender.HOST-MANAGER.File=${catalina.base}/logs/host-manager.
log4j.appender.HOST-MANAGER.Append=true
log4j.appender.HOST-MANAGER.Encoding=UTF-8
log4j.appender.HOST-MANAGER.DatePattern='.'yyyy-MM-dd'.log'
log4j.appender.HOST-MANAGER.layout = org.apache.log4j.PatternLayout
log4j.appender.HOST-MANAGER.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Encoding=UTF-8
log4j.appender.CONSOLE.layout = org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern = %d [%t] %-5p %c- %m%n
# Configure which loggers log to which appenders
log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=INFO, LOCALHOST
log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager]=\
INFO, MANAGER
log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager]=\
INFO, HOST-MANAGER
3. Now copy downloaded tomcat-juli.jar into tomcat/bin directory. You need to replace existing tomcat-juli.jar file.
4. Then remove tomcat/conf/logging.properties file.

Upgrade ImageMagick on Red Hat 5.8/ CentOS

Redhat Enterprise Linux 5.8 provides ImageMagick v 6.2.8. But you may require to upgrade it to higher version. I was looking for RPM of ImageMagick for RHEL 5.8 and I found it from ImageMagick Website. Just downloading and Installing RPM will not work, it took so much time to find its dependency packages and install it. So I have shared this post, I hope if you have this requirement, it will solve your purpose.

Operating System: Red Hat Enterprise Linux 5.8
Architecture: x86_64
ImageMagick: 6.2.8 (new version will be 6.8.5-8)


  • To check current version of ImageMagick use below command.
[root@localhost ~]# convert -version
Version: ImageMagick 6.2.8 12/13/11 Q16 file:/usr/share/ImageMagick-6.2.8/doc/index.html
Copyright: Copyright (C) 1999-2006 ImageMagick Studio LLC


  • Download ImageMagick RPM using below link.
http://www.imagemagick.org/download/linux/CentOS/x86_64/ImageMagick-6.8.5-10.x86_64.rpm

Now when you will try to install it on RHEL 5.8, you will get below error message for dependency packages.

[root@localhost ~]# rpm -ivh ImageMagick-6.8.5-10.x86_64.rpm
error: Failed dependencies:
libHalf.so.4()(64bit) is needed by ImageMagick-6.8.5-10.x86_64
libIex.so.4()(64bit) is needed by ImageMagick-6.8.5-10.x86_64
libIlmImf.so.4()(64bit) is needed by ImageMagick-6.8.5-10.x86_64
libImath.so.4()(64bit) is needed by ImageMagick-6.8.5-10.x86_64
libfftw3.so.3()(64bit) is needed by ImageMagick-6.8.5-10.x86_64
libjasper.so.1()(64bit) is needed by ImageMagick-6.8.5-10.x86_64
libltdl.so.3()(64bit) is needed by ImageMagick-6.8.5-10.x86_64
libwebp.so.4()(64bit) is needed by ImageMagick-6.8.5-10.x86_64
It was not easy to find dependency packages for ImageMagick, I have gone through different commands, googleing, etc. So finally I have all those dependency RPMs. You can download them using given below links.


ImageMagick-6.8.5-8.x86_64.rpm
OpenEXR-1.4.0a-5.el5.x86_64.rpm
fftw3-3.2.2-3.el5.x86_64.rpm
fltk-1.1.9-4.el5.i386.rpm
fltk-1.1.9-4.el5.x86_64.rpm
jasper-libs-1.900.1-14.el5.x86_64.rpm
libwebp4-0.3.0-31.2.x86_64.rpm
xz-libs-4.999.9-0.3.beta.20091007git.el5.x86_64.rpm
libtool-ltdl-1.5.22-7.el5_4.x86_64.rpm