FYI - replace log4j with updated jar and problem resolved. NOw to tackle the torque problem!

Katherine Stone <[EMAIL PROTECTED]> wrote:
Hello All,

I am really going bonkers over an error with my Log4j init.
I followed instructions here
http://mav.sourceforge.net/maverick-manual.html for initializing log4j.
What am I doing wrong?
 
-using tomcat 4.1.24
-log4j-1.1.3.jar in app\WEB-INF\lib
-log4j.properties in app\WEB-INF\lib
 
 
Following are the ERRORS, web.xml, my init servlet, log4j.properties
ERROR
====================================================================
Starting service Tomcat-Standalone
Apache Tomcat/4.1.24
MaverickLog4JInit:Finished Initializing Log4j using the properties file at: C:\tomcatNEW\jakarta-tomcat-4.1.24\webapps\app\WEB-INF\lib\log4j.properties
log4j:ERROR No appenders could be found for category (org.infohazard.maverick.Dispatcher).
log4j:ERROR Please initialize the log4j system properly.
Initializing Torque using the properties file at: C:\tomcatNEW\jakarta-tomcat-4.1.24\webapps\app\WEB-INF\Torque.properties
May 27, 2004 12:12:59 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on port 8080
 
 
WEB.XML
====================================================================
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "
http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<!--
 $Id: web.xml,v 1.2 2002/02/20 17:27:02 rcampbel Exp $
 $Source: /export/cvsroot/EX/hrc/web/WEB-INF/web.xml,v $
-->
<web-app>
 <context-param>
  <param-name>javax.servlet.jsp.jstl.temp.ExpressionEvaluatorClass</param-name>
  <param-value>org.infohazard.jstl.FixedJavascriptExpressionEvaluator</param-value>
 </context-param>
 <servlet>
  <servlet-name>log4jInit</servlet-name>
  <display-name>Maverick Log4J Init Servlet</display-name>
  <servlet-class>myorg.app.maverick.MaverickLog4JInit</servlet-class>
  <init-param>
        <param-name>log4jPropertiesFile</param-name>
        <param-value>WEB-INF\lib\log4j.properties</param-value>
     </init-param>
  <load-on-startup>2</load-on-startup> 
 </servlet>
 <servlet>
  <servlet-name>dispatcher</servlet-name>
  <display-name>Maverick Dispatcher</display-name>
  <servlet-class>myorg.utilapp.maverick.MaverickTorqueServlet</servlet-class>
  <init-param>
          <param-name>torquePropertiesLocation</param-name>
   <param-value>/WEB-INF/Torque.properties</param-value>
  </init-param>
  <init-param>
   <param-name>reloadCommand</param-name>
   <param-value>reload</param-value>
  </init-param>
      <init-param>
        <param-name>log4jPropertiesFile</param-name>
        <param-value>/WEB-INF/lib/log4j.properties</param-value>
      </init-param>
  <load-on-startup>3</load-on-startup>
 </servlet>
 <servlet-mapping>
  <servlet-name>dispatcher</servlet-name>
  <url-pattern>*.m</url-pattern>
 </servlet-mapping>
 
 
 <taglib>
  <taglib-uri>http://java.sun.com/jstl/ea/core</taglib-uri>
  <taglib-location>/WEB-INF/c.tld</taglib-location>
 </taglib>
 
<resource-ref>
  <res-ref-name>jdbc/foo</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>
 </resource-ref>
 
 
</web-app>
 
 
 
INIT SERVLET
====================================================================
package myorg.app.maverick;

import org.apache.log4j.PropertyConfigurator;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class MaverickLog4JInit extends HttpServlet {
 private static final String LOG4J_PROPERTIES_LOCATION =
  "log4jPropertiesFile";
 private static final String DEFAULT_LOG4J_PROPERTIES_LOCATION =
  "WEB-INF/lib/log4j.properties";
  
  public
  void init() {
 String log4jPropertiesLocation =
  getRealPathFromInitParam(
   LOG4J_PROPERTIES_LOCATION,
   DEFAULT_LOG4J_PROPERTIES_LOCATION);
 if (log4jPropertiesLocation != null) {
  PropertyConfigurator.configure(log4jPropertiesLocation);
 }
 System.out.println(
    "MaverickLog4JInit:Finished Initializing Log4j using the properties file at: "
     + log4jPropertiesLocation);
  }
  public
  void doGet(HttpServletRequest req, HttpServletResponse res) {
  }
 
  protected String getRealPathFromInitParam(
   String pInitParam,
   String pDefault){
   //get the path of the properties file, relative to webapp root
   String location = getServletConfig().getInitParameter(pInitParam);
   if (location == null) {
    location = pDefault;
   }
   //get the real path for the file based on the relative path
   return getServletContext().getRealPath(location);
  }
}
 
 

LOG4J.PROPERTIES
====================================================================
# Set root logger level to DEBUG and its only appender to console.
log4j.rootLogger=DEBUG, C, Chainsaw
log4j.logger.org.apache.commons=WARN
log4j.logger.org.apache.jk=WARN
log4j.category.org.apache.log4j.net.SocketNode=DEBUG
log4j.logger.org.apache.axis=INFO
#changed logging levels for torque and maverick packages 4-9-2004 KAStone
#log4j.logger.org.infohazard.maverick=INFO
#log4j.logger.org.apache.torque=INFO
#log4j.logger.myorg.maverick = INFO
 
#Chainsaw properties
log4j.appender.Chainsaw=org.apache.log4j.net.SocketAppender
log4j.appender.Chainsaw.remoteHost=localhost
log4j.appender.Chainsaw.port=4445
log4j.appender.Chainsaw.locationInfo=true
#log file in catalina log directory
log4j.appender.C=org.apache.log4j.DailyRollingFileAppender
log4j.appender.C.file=${catalina.home}/logs/cdb.log
log4j.appender.C.layout=org.apache.log4j.PatternLayout
log4j.appender.C.layout.ConversionPattern=%-4r %d [%t] %-5p %c %x - %m%n
log4j.appender.C.append=true
log4j.appender.C.datePattern='.'yyyy-MM-dd

#velocity loggger configuration
log4j.category.velocity = Chainsaw, C
log4j.additivity.velocity = false
 
As a side note I am also having torque init problems using jndi so I don't know if it is some glaring error in web.xml that is causing both of my problems?
 
Thanks in advance,
Kathy
 


Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger


Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger

Reply via email to