Ug,

Upon further examination of my code, it turns out I knew what I was doing after all. If you set the "log4j-log-home" context parameter in web.xml (currently commented out because it is an optional parameter which will always be system specific if supplied), then you *can* set the system property to your custom path, even in the case of serving your webapp out of a .war file. Not sure why I missed that before? I guess I can't read my own code :-(

See line 108 of the Log4jApplicationWatch.java file to see where I am talking about. You just need to make sure to uncomment and set the path in the web.xml. For instance...

<!-- optional param for use with a File Appender.
Specifies a path to be read from a log4j xml
config file as a system property. The property name is
dynamically generated and takes on the following pattern:
[webapp name].log.home
In Barracuda's case, it would be "Barracuda.log.home".
The path defaults to WEB-INF/logs directory, which is created
if it doesn't exist, unless the webapp is running directly
from a .war file.
Note that, if specified, the value is an absolute path, not
relative to the webapp. -->
<context-param>
<param-name>log4j-log-home</param-name>
<param-value>/usr/local/logs/tomcat</param-value>
</context-param>


Try that out and let me know if you still have any concerns.

Jake



At 07:40 PM 1/14/2003 -0800, you wrote:
Hello Jacob,

Thanks for the code and examples, looks to be exactly what I need. My only question is, and using your examples as reference, if I am deploying my web app via a .war file, and I want to create a FileAppender, do I have to hard code the physical path for the file in my log4j.xml. In your example, the Barracuda.log.home system variable is not available via .war. Is there no other way to dyamically derive the path for the file appender if deploying via .war?

Thanks again for your help.

Regards,
Carey

On Tue, 14 Jan 2003 18:55:48 -0600
Jacob Kjome <[EMAIL PROTECTED]> wrote:

Here is the promised initialization setup. Read "Usage.txt" in the attached zip file. I included both source and pre-built jars. I also included a sample logj4.xml file. See Usage.txt for specifics on what is unique about this log4j.xml file and for other info like web.xml config.

Oh, and Mark, I plan to submit this stuff under the Apache license. I just want to clean some stuff up first. I'll do that within the week. For now, you can take a look at what things will look like and provide some feedback.

Let me know if you have questions...

Jake

At 02:22 PM 1/14/2003 -0800, you wrote:
Thanks Jacob,

If you could pass on your updated code when you have time, I would greatly appreciate that.

Regards,
Carey

On Tue, 14 Jan 2003 13:03:56 -0600
Jacob Kjome <[EMAIL PROTECTED]> wrote:
Hello Carey,

Note that the stuff about Barracuda in my previous message will be
moving to Log4j-1.3. Some have already moved
(ContextClassLoaderSelector). However, for the time being, things
will exist in both places until Log4j-1.3 is released.

Just wanted to point that out.

Jake

Tuesday, January 14, 2003, 12:18:03 PM, you wrote:

CB> Hi,

CB> I am attempting to deploy a web application in WebLogic CB> via a war file. Since I have no way of determing the CB> actual path that Weblogic will use for deploying my war CB> file, I need a way to access my xml file that holds my CB> log4j properties. I can use CB> servletContext.getResourceAsStream() to get an InputStream CB> object of the xml file. With that what is the best way to CB> load my properties. I see there is a CB> DomConfigurator.doConfigure(InputStream, CB> LoggerRepository). Will this work and if so, what do I CB> pass in for the LoggerRepository object (not familiar with CB> that). In addition, is there a way to get the capability CB> of the watchdog with this?

CB> Thanks for your help!
CB> Carey


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



-- Best regards,
Jacob mailto:[EMAIL PROTECTED]


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

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

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

Reply via email to