Hi,

If I use getResourceAsStream() and then make a call to PropertyConfigurator.configure(properties). Is there a way to watch for changes in this property file? How do I use getResourceAsStream and have the ability to configure the log4j.properties file at run time?

On Oct 29, 2004, at 9:40 AM, Shapira, Yoav wrote:


Hi, Don't use getRealPath, it won't work when running from a packed WAR. Use Class#getResource(AsStream) or the equivalent methods in ServletContext.

Yoav Shapira http://www.yoavshapira.com


-----Original Message-----
From: Mufaddal Khumri [mailto:[EMAIL PROTECTED]
Sent: Friday, October 29, 2004 12:35 PM
To: Tomcat Users List
Subject: Re: Log4j question

Sorry, mistake on my part. The Log4j.properties is under /classes .
Works fine now.

On Oct 29, 2004, at 9:29 AM, Mufaddal Khumri wrote:

Hi,

I am new to Log4j and am trying to read the configuration settings
from WEB-INF/classes/log4j.properties

I am using Tomcat 5.0.27. I have been trying to do this in my
contextListener:

        public void contextInitialized(ServletContextEvent sce)
        {
                String fileName = sc.getRealPath("/") + "/WEB-
INF/log4j.properties";
                PropertyConfigurator.configureAndWatch(fileName,2000);
                ......
        }

As soon as I include those lines in my webapps context listener, my
webapp does not start on starting tomcat. When i comment
those lines off it starts normally. Any ideas whats going on here?


Mufaddal Khumri Software Developer Waves In Motion Phone: 602 956 7080 x 26 Email: [EMAIL PROTECTED]
Mufaddal Khumri
Software Developer
Waves In Motion
Phone: 602 956 7080 x 26
Email: [EMAIL PROTECTED]


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




This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you.


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


Mufaddal Khumri
Software Developer
Waves In Motion
Phone: 602 956 7080 x 26
Email: [EMAIL PROTECTED]


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



Reply via email to