struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mazharullah" <mazharulla...@cgdigital.biz>
Subject Re: Commons Logging Configuration
Date Mon, 10 Mar 2003 05:11:08 GMT
Hi Ashok

        Follow the below steps to configure and use the commons logging
library.

        1. Keep your configuration in /etc directory ( prefered location)
for ex. ( /etc/project.conf)
        2. If it is web application configure your web.xml file to get the
configuration file name. For example

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
  <servlet>
        <servlet-name>InitServlet</servlet-name>
        <description>Initiator </description>
        <servlet-class>package.subpackage.InitServlet</servlet-class>
        <init-param>
                <param-name>config </param-name>
                <param-value>/etc/project.conf </param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
  </servlet>
</web-app>

    3. In the startup servlet you use PropertyConfigurator to load the log4j
settings using the below statements

         import org.apache.log4j.Logger;
         import org.apache.log4j.PropertyConfigurator;
        ....
        public void init(ServletConfig config) throws ServletException {
            super.init(config);
            //Get the current host name
            try{

PropertyConfigurator.configure(config.getInitParameter("config"));
            }
            catch(Exception e){
                ....
            }
            ......
Regards
Mazharullah
Bangalore - India

----- Original Message -----
From: ashokd <ashokd@visualsoft-tech.com>
To: Struts Users Mailing List <struts-user@jakarta.apache.org>
Sent: Thursday, March 07, 2002 12:15 PM
Subject: Commons Logging Configuration


> Hi,
>
>     I have a question regarding configuration of  Commons Logging (for
> Log4j). Where I need to place this configuration property file. Their is
any
> user guide to configure commons Logging.
>
> Thanks & Regards,
> Ashok.D
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message