Fwd: Enhydra 5.1 Development Team, still have problems
Zoran Milakovic <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Organization | ProZone |
| Message-ID | <[email protected]> |
We still have problems with Barracuda logs.
Mr. Gwyn Ewans has right, Barracuda is too verbose for us.
We have example Barracuda
application in Enhydra which is located in webapps\BaracudaDiscRack.
We have next three .xml configuration files located in
webapps\BarracudaDiscRack\WEB-INF directory :
event-gateway.xml, log4j.xml, object-repository.xml and web.xml.
Barracuda does not look at log4j.xml for configuration.When we erase
log4j, it still logs in our log chanels which are defined in our
log4j.xml.
When we look in source of Barracuda we found
DOMConfigurator.configure() method in two classes (
DefaultApplicationAssembler and ObjectRepositoryAssembler ), and in both of
these calls to DOMConfigurator.configure() is in main() method.
How we can make Barracuda to look in WEB-INF\log4j.xml to configure
it's logger ?
This is how our web.xml look like :
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<display-name>Barracuda Disc Rack Demonstration Application</display-name>
<description>
Barracuda Disc Rack is an example application using the Open-Source
Barracuda Presentation Framework. It is akin to Java's Petstore
application. Barracuda Disc Rack is useful in displaying many of
the features that Barracuda has to offer. Take a test-drive and then
peruse the code that makes it all happen. We think you will be pleased
by what you see.
</description>
<distributable/>
<!-- ============================================================== -->
<!-- Context Parameters -->
<!-- ============================================================== -->
<!-- Log4j context parameters -->
<context-param>
<!-- preferred repository selector. "preferred" because if one
is already installed, this choice is ignored. -->
<param-name>log4j-selector</param-name>
<param-value>org.apache.log4j.selector.ContextJNDISelector</param-value>
</context-param>
<context-param>
<!-- relative path to config file within current webapp -->
<param-name>log4j-config</param-name>
<param-value>WEB-INF/log4j.xml</param-value>
</context-param>
<context-param>
<!-- config file re-reading specified in milliseconds...
Note that if the webapp is served directly from a
.war file, configureAndWatch() cannot be used because
it requires a system file path. In that case, this
param will be ignored. Set to 0 or don't specify this
param to do a normal configure(). -->
<param-name>log4j-cron</param-name>
<param-value>0</param-value>
</context-param>
<!-- Below are optional context params for use with a File Appender.
"log4j-log-home" specifies a path to be read from a log4j xml
config file as a system property. The system property name is
dynamically generated, by default, and takes on the following pattern:
[context path].log.home
If the app has a context path of "/Barracuda", the system
variable name would be "Barracuda.log.home". So,
the FileAppender in log4j.xml would contain a param which looks like:
<param name="File" value="${Barracuda.log.home}/arbitraryLogFileName.log" />
Dynamic generation of a predictable system property name has only been tested
successfully on Tomcat and may not work in other containers. As such,
one may specify the desired system property name using the
"log4j-sysprop-name". If specified, this name will be used
in place of the dynamically generated system property name. It is
recommended that naming pattern match that described above.
If the "log4j-log-home" context param is not specified, the
path associated with the generated system variable defaults to
the WEB-INF/logs directory of the current webapp which is created
if it doesn't exist... unless the webapp is running directly
from a .war file. In the latter case, this context param
*must* be specified if using a FileAppender.
Note that, if specified, the value is treated as an absolute
system path which is not relative to the webapp. -->
<!-- <context-param>
<param-name>log4j-log-home</param-name>
<param-value>/usr/local/logs/tomcat</param-value>
</context-param> -->
<!-- <context-param>
<param-name>log4j-sysprop-name</param-name>
<param-value>Barracuda.log.home</param-value>
</context-param> -->
<!-- ============================================================== -->
<!-- Filters -->
<!-- ============================================================== -->
<!-- ============================================================== -->
<!-- Filter Mappings -->
<!-- ============================================================== -->
<!-- ============================================================== -->
<!-- Listeners - Note: Optional. May be commented out for those -->
<!-- limited to Servlet-2.2 compliant engines -->
<!-- ============================================================== -->
<!-- Shuts down all loggers and appenders at webapp shutdown -->
<listener>
<listener-class>
org.apache.log4j.servlet.InitContextListener
</listener-class>
</listener>
<!-- ============================================================== -->
<!-- ObjectRepositoryAssembler declarations -->
<!-- ============================================================== -->
<!-- GlobalRepository Setup -->
<servlet>
<servlet-name>GlobalRepositoryAssembler</servlet-name>
<servlet-class>org.enhydra.barracuda.plankton.data.ObjectRepositoryAssembler</servlet-class>
<init-param>
<param-name>AssemblyDescriptor</param-name>
<param-value>WEB-INF/object-repository.xml</param-value>
</init-param>
<init-param>
<param-name>LogHeartbeat</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<!-- ============================================================== -->
<!-- Baracuda declarations -->
<!-- ============================================================== -->
<!-- If you are going to use the event model, you must specify the -->
<!-- ApplicationGateway -->
<servlet>
<servlet-name>ApplicationGateway</servlet-name>
<servlet-class>org.enhydra.barracuda.discRack.DiscRackGateway</servlet-class>
<init-param>
<param-name>ConfFile</param-name>
<param-value>/WEB-INF/discRack.conf</param-value>
</init-param>
<init-param>
<param-name>ApplicationAssembler</param-name>
<param-value>org.enhydra.barracuda.core.event.DefaultApplicationAssembler</param-value>
</init-param>
<init-param>
<param-name>AssemblyDescriptor</param-name>
<param-value>/WEB-INF/event-gateway.xml</param-value>
</init-param>
<init-param>
<param-name>SAXParser</param-name>
<param-value>org.apache.xerces.parsers.SAXParser</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
<!-- If you are going to use BAction components on HTML Forms, -->
<!-- you must specify the FormGateway -->
<servlet>
<servlet-name>FormGateway</servlet-name>
<servlet-class>org.enhydra.barracuda.core.comp.helper.FormGateway</servlet-class>
</servlet>
<!-- If you want to support disabling the back button on HTML Forms -->
<!-- you must specify the ParamGateway -->
<servlet>
<servlet-name>ParamGateway</servlet-name>
<servlet-class>org.enhydra.barracuda.core.helper.servlet.ParamGateway</servlet-class>
</servlet>
<!-- Barracuda can load static resources (like images and scripts) -->
<!-- from a jar file in the classpath by using the ResourceGateway. -->
<servlet>
<servlet-name>ResourceGateway</servlet-name>
<servlet-class>org.enhydra.barracuda.core.helper.servlet.ResourceGateway</servlet-class>
</servlet>
<!-- ============================================================== -->
<!-- Custom declarations -->
<!-- ============================================================== -->
<!-- ============================================================== -->
<!-- Baracuda mappings -->
<!-- ============================================================== -->
<!-- This is needed for the ApplicationGateway -->
<servlet-mapping>
<servlet-name>ApplicationGateway</servlet-name>
<url-pattern>*.event</url-pattern>
</servlet-mapping>
<!-- This is needed for the FormGateway -->
<servlet-mapping>
<servlet-name>FormGateway</servlet-name>
<url-pattern>*.form_forward</url-pattern>
</servlet-mapping>
<!-- This is needed for the ParamGateway -->
<servlet-mapping>
<servlet-name>ParamGateway</servlet-name>
<url-pattern>*.param_map</url-pattern>
</servlet-mapping>
<!-- This is needed for the ResourceGateway -->
<servlet-mapping>
<servlet-name>ResourceGateway</servlet-name>
<url-pattern>/xlib/*</url-pattern>
</servlet-mapping>
<!-- ============================================================== -->
<!-- Custom mappings -->
<!-- ============================================================== -->
<!-- ============================================================== -->
<!-- Baracuda configuration -->
<!-- ============================================================== -->
<session-config>
<!-- session timeout specified in minutes -->
<session-timeout>10</session-timeout>
</session-config>
<!-- ============================================================== -->
<!-- Custom Mime Mappings -->
<!-- ============================================================== -->
<!-- For Tomcat 3.3 compatibility with Mozilla in Strict -->
<!-- parsing mode -->
<mime-mapping>
<extension>css</extension>
<mime-type>text/css</mime-type>
</mime-mapping>
<!-- Inexplicably, there are no xml/xsl mime mappings in Tomcat-4.1.10.
This is fixed in Tomcat-4.1.11, but add them here for safety. -->
<mime-mapping>
<extension>xml</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xsl</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<!-- ============================================================== -->
<!-- Custom Welcome File List -->
<!-- ============================================================== -->
<!-- ============================================================== -->
<!-- Custom Error Page -->
<!-- ============================================================== -->
<!-- ============================================================== -->
<!-- JNDI Resources -->
<!-- ============================================================== -->
<env-entry>
<description>JNDI logging context for this webapp</description>
<env-entry-name>log4j/logging-context</env-entry-name>
<env-entry-value>BarracudaDiscRack</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
<!-- ============================================================== -->
<!-- Security settings -->
<!-- ============================================================== -->
</web-app>
Enhydra Development Team,
23.09.2003