Pour nos applications développées en JEE nous avions un sérieux problème de log tomcat qui se remplissaient pour atteindre des tailles critiques mettant en péril le fonctionnement de nos applications. Après des essais, un peu de lecture l’équipe R&D d’Easyflyer a décidée d’abandonner la configuration du moteur JULI installé par défaut dans Tomcat (version 6.0 pour nous), et de remplacer le moteur par log4j.
Voici la procédure à suivre pour installer Log4j dans Tomcat :
1. Télécharger les librairies nécessaires
Les librairies nécessaires sont :
- log4j version >= 1.2.x
- les jar tomcat-juli-adapters.jar et tomcat-juli.jar.
Les jars tomcat-julixx.jar sont téléchargeables à partir du site Apache Tomcat dans la rubrique download correspondant à votre numéro de version. Il faut se rendre ensuite dans la rubrique Quick Navigation -> Browse, et se déplacer dans bin?extra.
2. Déplacer les librairies
- copier tomcat-juli.jar dans le répertoire bin de Tomcat
- copier tomcat-juli-adapters.jar dans le répertoire lib de Tomcat
3. Création du fichier de configuration
Le fichier de configuration log4j.properties doit être placé dans le répertoire lib de Tomcat. Voici un exemple de configuration :
log4j.rootLogger=INFO, CATALINA
# Define all the appenders
log4j.appender.CATALINA=org.apache.log4j.DailyRollingFileAppender
log4j.appender.CATALINA.File=${catalina.base}?logs?catalina.out
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.out
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.out
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.out
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
Un petit redémarrage de Tomcat et le tour est joué.


15 Comments
Fouad Mz
15 mars 2013 - 11 h 41 minBonjour,
J’ai un souci avec le DailyRollingFileAppender.
Il faut que je redémarre mon serveur Tomcat pour que les fichiers logs soient créés ! Les logs ne sont pas créés à minuit comme je le souhaite, quand j’arrive le matin, rien n’est créé !
Je suis sur un environnement Linux + apache-tomcat-6.0.35 + log4j-1.2.15.
Nicolas BESNARD
17 mars 2013 - 10 h 03 minEst-ce que tu as modifié la config tomcat pour qu’il utilise log4j au lieu de Juli ?
Peux-tu envoyer ta section concernant DailyRollingFileAppender de ton fichier log4j.properties ?
Get More Information
18 mai 2013 - 15 h 00 minHelpful information. Lucky me I found your site by accident, and I am shocked why this twist of fate did not took place earlier!
I bookmarked it.
download bodog poker
16 juillet 2026 - 12 h 59 minIf you’re after the Bodog poker download, this is the place to get it. Easy peasy, and you’re playing in minutes. Check here to download download bodog poker.
lotus365appdownload
16 juillet 2026 - 12 h 59 minSnagged the Lotus365appdownload the other day and it’s been solid. No lag, easy to nav. Grab the app for yourself: lotus365appdownload
loverummyappbet
16 juillet 2026 - 12 h 59 minLoverummyappbet is kinda addictive. Quick games and good payouts. Worth a download for sure! Download it here: loverummyappbet
casinobaloto
8 août 2026 - 21 h 21 minRunning this platform for several months now and the consistency never falters. Deposits reflect instantly and the game filters make it so easy to find exactly what I want. The support team goes above and beyond whenever I need help with account verification. A reliable spot that truly puts player satisfaction first. casinobaloto
cobetwin
8 août 2026 - 21 h 22 minGreat atmosphere and super responsive staff who actually care about player feedback. I have been playing here for a few months now and the experience just keeps getting better every single week. cobetwin
done555gamedownload
8 août 2026 - 21 h 22 minI was looking for a reliable gaming companion and this one delivered. The games load fast and the rewards feel genuine. It is such a joy to explore new titles here.
n98slot
9 août 2026 - 1 h 09 minThe slot games here are exactly what I look for when I want to unwind. The graphics are top notch and I actually enjoy the gameplay mechanics instead of just tapping blindly. Highly recommend for slot fans. n98slot
ph5566jili
9 août 2026 - 1 h 09 minAs a regular player in Manila I can say this platform really understands what we want. The withdrawal speed is impressive and the game selection is packed with local favorites. I appreciate how safe the environment feels while I am spinning away after work. Definitely my go to spot for weekend entertainment. ph5566jili
betvisaloginbd
9 août 2026 - 1 h 10 minFinding a reliable betting login page that actually works smoothly is never easy but this platform changed my routine completely. The quick access and secure connection make daily play stress free and fun. I love how they keep updates transparent and handle withdrawals fast. Highly recommend checking it out betvisaloginbd
jack999games
18 août 2026 - 6 h 39 minI used to struggle finding sites that actually pay out on time but jack999games completely changed my routine. The daily promotions are fun and the slots library keeps getting better with new titles. It really feels like a community where players are welcomed with open arms so stop by jack999games whenever you need a break jack999games
king88betlink
18 août 2026 - 6 h 40 minI mainly use it for live sports betting and the odds are genuinely competitive compared to the big names. The app never crashes even during major match days which is a massive relief. I also love the quick bet feature since it saves me so much time when I want to jump on a short window opportunity. Highly recommended for sports fans king88betlink
netbetbono
18 août 2026 - 6 h 40 minThe welcome package here is genuinely one of the best I have come across this year. Free spins arrive on schedule and the promo code updates keep the gameplay fresh. I never feel like I am chasing impossible conditions just to enjoy a bonus. Browse the current deals at netbetbono.