[Tomcat] Comment configurer log4j ?

Comment configurer log4j ? [Tomcat] - Java - Programmation

Marsh Posté le 20-12-2006 à 10:37:48    

J'ai beaucoup de mal, même après avoir fait le step-by-step sur le site d'apache,  à configurer le log4j pour Tomcat.
En clair j'ai TOUJOURS l'erreur suivante quand je démarre Tomcat :

log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester.sax).
log4j:WARN Please initialize the log4j system properly.


 
Alors j'ai "tout mis partout" :
 
dans Tomcat 5.5\common\classes : log4j.xml et log4j.properties
dans Tomcat 5.5\common\lib : log4j-1.2.8.jar et commons-logging.jar
dans Tomcat 5.5\logs : tomcat.log
 
dans ma WEB-APP :
 
sous WEB-INF\lib : log4j-1.2.8.jar et commons-logging.jar
 
Le contenu de mon log4j.properties (celui d'Apache) :
 

#
# Configures Log4j as the Tomcat system logger
#
 
#
# Configure the logger to output info level messages into a rolling log file.
#
log4j.rootLogger=INFO, R
 
#
# To continue using the "catalina.out" file (which grows forever),
# comment out the above line and uncomment the next.
#
#log4j.rootLogger=ERROR, A1
 
#
# Configuration for standard output ("catalina.out" ).
#
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
#
# Print the date in ISO 8601 format
#
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
 
#
# Configuration for a rolling log file ("tomcat.log" ).
#
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.DatePattern='.'yyyy-MM-dd
#
# Edit the next line to point to your logs directory.
# The last part of the name is the log file name.
#
log4j.appender.R.File="C:\Program Files\Apache Software Foundation\Tomcat 5.5\logs\tomcat.log"
log4j.appender.R.layout=org.apache.log4j.PatternLayout
#
# Print the date in ISO 8601 format
#
log4j.appender.R.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
 
#
# Application logging options
#
#log4j.logger.org.apache=DEBUG
#log4j.logger.org.apache=INFO
#log4j.logger.org.apache.struts=DEBUG
#log4j.logger.org.apache.struts=INFO


 
Contenu de log4j.xml :
 

<?xml version="1.0" encoding="UTF-8"?>
 
<!--
 * Copyright 2002-2005 The Apache Software Foundation.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License" );
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
-->
 
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
 
<log4j:configuration>
 
  <appender name="logfile" class="org.apache.log4j.FileAppender">
    <param name="File"   value="C:\Program Files\Apache Software Foundation\Tomcat 5.5\logs\tomcat.log" />
    <param name="Append" value="true" />
    <param name="Encoding" value="UTF-8" />
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern"
          value="%d{yyyy-MM-dd HH:mm:ss} %-5p - %c:%L - %m%n"/>
      <!--
        %d{...} date pattern
        %p      priority
        %m      log message
        %n      newline
        -5      fill with spaces (5)
 
        For more options see class org.apache.log4j.PatternLayout.
      -->
    </layout>
  </appender>
 
<!--
  <category name="org.apache.myfaces.tobago.config.ThemeConfig">
    <priority value="debug"/>
  </category>
-->
 
<!--  <category name="org.apache.commons">-->
<!--    <priority value="info" />-->
<!--  </category>-->
 
<!--  <category name="org.apache.myfaces.tobago.demo">-->
<!--    <priority value="debug" />-->
<!--  </category>-->
 
<!--  <category name="org.apache.myfaces.tobago.miniHowto">-->
<!--    <priority value="debug" />-->
<!--  </category>-->
 
<!--  <category name="org.apache.myfaces.tobago.overview">-->
<!--    <priority value="debug" />-->
<!--  </category>-->
 
<!--  <category name="org.apache.myfaces.tobago.util.LayoutInfo">-->
<!--    <priority value="debug" />-->
<!--  </category>-->
 
  <!--<category name="org.apache.myfaces.tobago.config.ThemeConfig">-->
    <!--<priority value="debug" />-->
  <!--</category>-->
 
  <!--<category name="org.apache.myfaces.tobago.application.ViewHandlerImpl">-->
    <!--<priority value="debug" />-->
  <!--</category>-->
 
  <!--<category name="org.apache.myfaces.tobago.component.ComponentUtil">-->
    <!--<priority value="debug" />-->
  <!--</category>-->
 
<!--  <category name="org.apache.catalina.core.ApplicationDispatcher">-->
<!--    <priority value="debug" />-->
<!--  </category>-->
 
  <category name="org.apache.myfaces.tobago.renderkit.html.scarborough.standard.tag,SheetPageCommandRenderer">
    <priority value="debug" />
  </category>
 
  <!--<category name="org.apache.myfaces.tobago.overview">-->
    <!--<priority value="debug" />-->
  <!--</category>-->
 
  <!--<category name="org.apache.myfaces.tobago.component.UITree">-->
    <!--<priority value="debug" />-->
  <!--</category>-->
 
  <!--<category name="org.apache.myfaces.tobago.component.UITreeNode">-->
    <!--<priority value="debug" />-->
  <!--</category>-->
 
  <!--<category name="org.apache.myfaces.tobago.renderkit.InputRendererBase">
    <priority value="debug" />
  </category>-->
 
  <root>
    <priority value="error" />
    <appender-ref ref="logfile" />
  </root>
 
</log4j:configuration>
 


 
Je n'ai jamais rien dans mon Tomcat.log malgré des erreurs de démarrage de tomcat :
 

log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester.sax).
log4j:WARN Please initialize the log4j system properly.
java.lang.NullPointerException
 at org.apache.commons.digester.Digester.getXMLReader(Digester.java:899)
 at org.apache.commons.digester.Digester.parse(Digester.java:1647)
 at org.apache.myfaces.config.impl.digester.DigesterFacesConfigUnmarshallerImpl.getFacesConfig(DigesterFacesConfigUnmarshallerImpl.java:183)
 at org.apache.myfaces.config.FacesConfigurator.feedStandardConfig(FacesConfigurator.java:152)
 at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:126)
 at org.apache.myfaces.webapp.StartupServletContextListener.initFaces(StartupServletContextListener.java:69)
 at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:52)
 at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3729)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4187)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
 at org.apache.catalina.core.StandardService.start(StandardService.java:450)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
20 déc. 2006 10:22:48 org.apache.catalina.core.StandardContext start
GRAVE: Error filterStart


 
Des conflits de librairies .jar se posent (mélange de Myfaces + Tomahawk + ADF puis j'essaie de rajouter ICE FACES)

Reply

Marsh Posté le 20-12-2006 à 10:37:48   

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed