Marcelo

Thanks, Will try to make sure that Log4J initializes prior to ActionServlet
load. Earlier, I had a Logger class which had a Category instance
initialized in a static block. Looks like my Logger was loaded prior to
ActionServlet with 1.0.2. Now, I guess I have to write a startup servlet and
load it prior to ActionServlet as you said.

have a good weekend
hemant


public class Logger
{
        static Category category = Category.getInstance("mpi");
    static {
        try
            {

            String pc = CommonConstants.LOG4JPATH;
            System.out.println("pc is " + pc);
            if ((pc.trim().length() > 0) && (null != pc))
                {
                Properties pp = new Properties();
                URL url = pp.getClass().getResource(pc);
                PropertyConfigurator.configure(url);
            }
            else
                {
                BasicConfigurator.configure();
            }
        }
        catch (Exception e)
            {
            System.err.println("Error in Configuration: " + e);
        }
    }

///////////////////////
// Lots of methods here for debug(), info(), etc
//////////////////////

}




-----------------------------------------------------------

> hemant wrote:
> > The Log4J configuration loaded property when I used Struts 1.0.2. If it
> > worked then, shouldn't it work now with struts 1.1beta?
>
> It worked with 1.0.2, but Struts did not use the commons-logging package
> then, so the log messages weren't printed through Log4j, which is the
> case now.
>
> It seems that you initialize the log4j configuration after the Struts'
> ActionServlet loads, so when the ActionServlet (and the Digester, and
> Beanutils, etc) try to log and log4j is not yet configured, you get that
> error.
>
> I have a servlet that loads some configuration for my application. I've
> set it up so that it loads before the Struts' ActionServlet, so that the
> log4j system is properly initialized when called. Try do do something
> similar.
>
> --
> []'s
> Marcelo Vanzin
> Touch Tecnologia
> [EMAIL PROTECTED]
> "Life is too short to drink cheap beer"
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to