Author: rich
Date: Sun Sep 19 09:45:12 2004
New Revision: 46333
Added:
incubator/beehive/trunk/netui/src/webapp-template/logging/
incubator/beehive/trunk/netui/src/webapp-template/logging/log4j.xml
(contents, props changed)
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java
incubator/beehive/trunk/netui/src/webapp-template/dd/generic/web.xml
Log:
- Added a default log4j.xml to the webapp template, under WEB-INF/src (to be
copied to WEB-INF/classes during the build).
- Got rid of an error logged in the case where there is no
jpf-struts-config.xml file in the webapp, but it is registered in web.xml.
Specifically, the error no longer appears when:
- the default (root) Struts module config file registered in web.xml is not
present, and
- its location is in the list of locations we search automatically for
output from the page flow compiler.
- Removed the (unnecessary) registration of the jpf-struts-config--global.xml
Struts module from the webapp template's web.xml.
DRT: netui (WinXP)
BB: self (linux)
Modified:
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java
==============================================================================
---
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java
(original)
+++
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java
Sun Sep 19 09:45:12 2004
@@ -94,12 +94,11 @@
public void init( ServletConfig config )
throws ServletException
{
- super.init( config );
-
_moduleConfigLocators = getDefaultModuleConfigLocators();
//
// Look for ModuleConfigLocators specified in web.xml.
+ // TODO: move this to netui-config.xml
//
String configLocatorList = config.getInitParameter(
MODULE_CONFIG_LOCATOR_CLASS_ATTR );
@@ -149,6 +148,8 @@
_moduleConfigLocators = ( ModuleConfigLocator[] )
locators.toArray( new ModuleConfigLocator[0] );
}
+
+ super.init( config );
}
/**
@@ -206,8 +207,7 @@
for ( int i = 0; i < _moduleConfigLocators.length; ++i )
{
ModuleConfigLocator locator = _moduleConfigLocators[i];
-
- String moduleConfigPath = locator.getModuleConfigPath(
modulePath );
+ String moduleConfigPath = locator.getModuleConfigPath(
modulePath );
try
{
@@ -227,6 +227,20 @@
return null;
}
+ private boolean isAutoLoadModulePath( String modulePath, String prefix )
+ {
+ if ( _moduleConfigLocators != null )
+ {
+ for ( int i = 0; i < _moduleConfigLocators.length; ++i )
+ {
+ ModuleConfigLocator locator = _moduleConfigLocators[i];
+ if ( modulePath.equals( locator.getModuleConfigPath( prefix )
) ) return true;
+ }
+ }
+
+ return false;
+ }
+
//
// For cases where the servlet is serialized/deserialized, we'll hold onto
ServletConfig
// attributes, since the ServletConfig reference is transient. Then,
we'll return these
@@ -378,7 +392,7 @@
URL url = getServletContext().getResource(path);
//
- // THIS IS THE ONLY DIFFERENCE: we're doing a null-check here.
+ // THIS IS THE MAIN DIFFERENCE: we're doing a null-check here.
//
if ( url != null )
{
@@ -401,7 +415,25 @@
}
else
{
- _log.error( Bundle.getString(
"PageFlow_Struts_MissingModuleConfig", path ) );
+ //
+ // Special case. If this is the default (root) module and
the module path is one that's normally
+ // generated by the page flow compiler, then we don't want
to error out if it's missing, since
+ // this probably just means that there's no root-level
page flow. Set up a default, empty,
+ // module config.
+ //
+ if ( prefix.equals( "" ) && isAutoLoadModulePath( path,
prefix ) )
+ {
+ if ( _log.isInfoEnabled() )
+ {
+ _log.info( "There is no root module at " + path +
"; initializing a default module." );
+ }
+
+ // The one that's being set up now is sufficient.
+ }
+ else
+ {
+ _log.error( Bundle.getString(
"PageFlow_Struts_MissingModuleConfig", path ) );
+ }
}
}
Modified: incubator/beehive/trunk/netui/src/webapp-template/dd/generic/web.xml
==============================================================================
--- incubator/beehive/trunk/netui/src/webapp-template/dd/generic/web.xml
(original)
+++ incubator/beehive/trunk/netui/src/webapp-template/dd/generic/web.xml
Sun Sep 19 09:45:12 2004
@@ -58,10 +58,6 @@
<param-value>/WEB-INF/.pageflow-struts-generated/jpf-struts-config.xml</param-value>
</init-param>
<init-param>
- <param-name>config/-global</param-name>
-
<param-value>/WEB-INF/.pageflow-struts-generated/jpf-struts-config--global.xml</param-value>
- </init-param>
- <init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
Added: incubator/beehive/trunk/netui/src/webapp-template/logging/log4j.xml
==============================================================================
--- (empty file)
+++ incubator/beehive/trunk/netui/src/webapp-template/logging/log4j.xml Sun Sep
19 09:45:12 2004
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+ <appender name="BEEHIVE_FILE_LOG"
class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="beehive.log"/>
+ <param name="Append" value="true"/>
+ <param name="MaxFileSize" value="500000KB"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{DATE} %-5p %-15c{1} [%x]:
%m%n"/>
+ </layout>
+ </appender>
+
+ <appender name="BEEHIVE_CONSOLE_LOG"
class="org.apache.log4j.ConsoleAppender">
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{DATE} %-5p %-15c{1} [%x]:
%m%n"/>
+ </layout>
+ </appender>
+
+ <!-- Beehive -->
+ <category name="org.apache.beehive">
+ <priority value="warn"/>
+ <appender-ref ref="BEEHIVE_CONSOLE_LOG"/>
+ </category>
+
+ <!-- NetUI Script: this allows separate configuration of script error
reporting -->
+ <category name="org.apache.beehive.netui.script">
+ <priority value="error"/>
+ <appender-ref ref="BEEHIVE_CONSOLE_LOG"/>
+ </category>
+
+ <!-- Struts -->
+ <category name="org.apache.struts">
+ <priority value="warn"/>
+ <appender-ref ref="BEEHIVE_CONSOLE_LOG"/>
+ </category>
+
+ <!-- Jakarta Commons -->
+ <category name="org.apache.commons">
+ <priority value="warn"/>
+ <appender-ref ref="BEEHIVE_CONSOLE_LOG"/>
+ </category>
+
+</log4j:configuration>