Marcelo
Thanks for your time,
here is the servlet part of the web.xml you asked for..
Regards
hemant
///////////////////////////////web.xml start
/////////////////////////////////////////////
<web-app>
<!--StartupManager-->
<servlet>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>LOG4J_CONFIG</param-name>
<param-value>/com/jny/operations/mplanning/mpi/properties/log4j.properties</
param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>application</param-name>
<param-value>com.jny.operations.mplanning.mpi.properties.ApplicationResource
s</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>validate</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
/////...................... more web.xml details.....
////////////////////////////////web.xml
end////////////////////////////////////////////
The following is my init method...
////////////////////////////////////init()
start///////////////////////////////////////////////
public void init()
{
// insert code to initialize the servlet here
// Testing Log4J...............................
try
{
String configFile =
getServletConfig().getInitParameter("LOG4J_CONFIG");
Logger logger = new Logger(configFile);
}
catch (Exception e)
{
System.out.println("The exception is " + e.toString());
}
}
////////////////////////////////////init()
end///////////////////////////////////////////////
//////////////////////////////////Logger class
start////////////////////////////////////////////
public class Logger
{
static Category cat = Category.getInstance("mpi");
public Logger(String log4jpath)
{
try
{
if ((null != log4jpath) && (log4jpath.trim().length() > 0) )
{
Properties pp = new Properties();
URL url = pp.getClass().getResource(log4jpath);
PropertyConfigurator.configure(url);
}
else
{
BasicConfigurator.configure();
}
}
catch (Exception e)
{
System.err.println("Error in Configuration: " + e);
}
///////////////////////
// Lots of methods here for debug(), info(), etc for example...
// public static void info(String message)
// {
// cat.info(message);
// }
//////////////////////
}
}
/////////////////////////////////Logger
End/////////////////////////////////////////////////////
----- Original Message -----
From: "Marcelo Vanzin" <vanza@rededc.com.br>
To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
Sent: Monday, April 01, 2002 1:32 PM
Subject: Re: Struts 1.1Beta and Log4J, "No appender" Issue
>
> Could you post the part of your web.xml where the servlets are declared,
> and the init() method of your StartupManager servlet, so I could take a
> look at them?
>
> I have the same setup as you seem to have (a servlet loading the Log4j
> configuration prior to the ActionServlet loading) and I never get this
> error.
>
> hemant wrote:
> > I tried to load my StartupManager Servlet which loads the Log4J
> > configuration prior to ActionServlet load but in vain.
> >
> > I still get the following..
> >
> > log4j: No appenders could be found for category
> > (org.apache.commons.digester.Digester).
> > log4j: Please initialize the log4j system properly
>
>
> --
> []'s
> Marcelo Vanzin
> Touch Tecnologia
> vanza@rededc.com.br
> "Life is too short to drink cheap beer"
>
>
> --
> To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>
|