RE: addEventlistener question

"David R Robison" <[email protected]>
Newsgroups gmane.comp.java.enhydra.barracuda.general
Message-ID <002301c2e418$8f4bc210$0864a8c0@D901K911>
If I use 
 
<Context path="/myapp" docBase="myapp">
    <Parameter name="log4j-log-home" override="true"
value="C:/java/logs/tomcat"/>
</Context>


in a context configuration file could I reference the parameter from
inside a servlet? For example,
System.getProperties().getProperty("log4j-log-home); ?
 
David R Robison
Open Roads Consulting, Inc.
http://www.openroadsconsulting.com
 
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Jacob Kjome
Sent: Tuesday, March 04, 2003 4:20 PM
To: [email protected]
Subject: RE: [Barracuda] addEventlistener question
 

I see.

I suppose I should have stated that the InitContextListener has only
been tested to work with the autodiscovery of the location of the
WEB-INF/logs directory of the current running application in
Tomcat-4.1.x.  You should be able to fix that by specifying your own
log4j-log-home context parameter...

<context-param>
        <param-name>log4j-log-home</param-name>
        <param-value>/usr/local/logs/tomcat</param-value>
</context-param>

Note that it is commented out in all examples in Barracuda and
BarracudaDiscRack's web.xml files.  If provided, the InitContextListener
will use that path instead of dynamically figuring it out for itself.
Make sure to use forward slashes on Windows platforms such as...

C:/java/logs/tomcat

You, actually, don't have to edit web.xml if you don't want to.  Most
any platform should provide proprietary server configuration to override
context parameters set in the web.xml.  In Tomcat, you'd do...

<Context path="/myapp" docBase="myapp">
    <Parameter name="log4j-log-home" override="true"
value="C:/java/logs/tomcat"/>
</Context>

Note you can put that in a Context configuration file instead of having
to edit server.xml.

Now, I'm not so familiar with configuration for Enhydra, but I imagine
it provides similar capabilities.


hope that helps!

Jake

At 03:54 PM 3/4/2003 -0500, you wrote:



This problem seems to be related to running from Enhydra. When I run
with Tomcat, the logging works normally.

 

David R Robison

Open Roads Consulting, Inc.

http://www.openroadsconsulting.com

 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Jacob Kjome
Sent: Tuesday, March 04, 2003 11:46 AM
To: [email protected]
Subject: RE: [Barracuda] addEventlistener question

 

At 10:11 AM 3/4/2003 -0500, you wrote:

4) I'm having trouble getting log4j to find any appenders. I used the
web.xml
and log4j.xml from the latest BarracudaDiscRack as an example. I tried
to
sepecify logging of debug message, but I got nothing conclusive. 




Make sure you modify the log4j.xml.  Note that the FileAppender is set
up with a dynamic variable:  "${BarracudaDiscRack.log.home}".  Change
"BarracudaDiscRack" to the name of your context.  For instance, if your
context path is "/myapp", then it would be "${myapp.log.home}".  Look at
sample.log4j.xml in BarracudaDiscRack and notice that this value is
dynamically generated by the build using a filter copy of
sample.log4j.xml to log4j.xml.

Now, in the web.xml, make sure that you have....

<listener>
        <listener-class>
        org.apache.log4j.servlet.InitContextListener
        </listener-class>
</listener>

That listener class will determine the location of the [context
name].log.home variable dynamically.  Output will go to file if you
haven't changed the <appender-ref ref="A2"/> in the <root> logger.  Make
sure to add your other loggers to the log4j.xml if you want things
logged.  You can also change this at runtime since confgureAndWatch is
done by default.  Additionally, you can put the barracuda-config.jar in
your app and add the following to your event-gateway.xml file...

<event-gateway class="org.enhydra.barracuda.config.BarracudaConfig" />

Then you can go to http://localhost:8080/myapp/GetBConfig.event

You can now turn on and off various loggers and set different levels.

Let me know if you still have problems logging.

Jake
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.