Apache Portals Applications Logging, (APA Logging), is a utility library used to setup and deploy logging configuration properties for portlet and portal web applications. APA Logging is currently used by all APA web applications and the Jetspeed 2 portal to initialize the internal Log4j logging implementations. This approach is independent of APA and Jetspeed 2 and can be used stand alone in any application container. The following containers are supported:
APA Logging utilities manage and provide a system property, org.apache.portals.logdir, that
can be used by deployed web applications to collocate logs in a centralized location external to the
web application itself. The utilities include an application web container listener to set the property
globally before web applications are started and tools to automate the configuration of this listener.
Any logging solution can be used with APA Logging that can be configured using the
org.apache.portals.logdir system property. Log4j is used internally by most of the APA portlet
applications and Jetspeed 2. Here is and example Log4j configuration, (log4j.properties),
that leverages these utilities:
# root logger
log4j.rootLogger = ERROR, pa
# portlet application category
log4j.category.org.apache.portals = INFO, pa
log4j.additivity.org.apache.portals = false
# portlet application APA Logging log file
log4j.appender.pa = org.apache.log4j.FileAppender
log4j.appender.pa.file = ${org.apache.portals.logdir}/my-pa.log
log4j.appender.pa.layout = org.apache.log4j.PatternLayout
log4j.appender.pa.layout.conversionPattern = %d [%t] %-5p %c - %m%n
log4j.appender.pa.append = false
Since the APA Logging approach depends only on a global system property, manual configuration that does
not utilize these utilities is possible in most web application container environments. For Tomcat, one
can specify system properties on the command line or in the CATALINA_OPTS environment
variable using the standard JVM syntax:
-Dorg.apache.portals.logdir=/var/log/portal
The Tomcat listener implementation, LoggingPropertiesServerListener, uses the
catalina.base or catalina.home system properties to locate the Tomcat logs
directory by default. The listener can also be instantiated with the logdir attribute to
specify the APA Logging property value. To use the default Tomcat logs directory, the following tag
must be inserted in the Server, Service, or Engine
configurations in the Tomcat server.xml file:
<Listener className="org.apache.portals.applications.logging.tomcat.LoggingPropertiesServerListener"/>
<Listener className="org.apache.portals.applications.logging.tomcat.LoggingPropertiesServerListener" logdir="/var/log/portal"/>
server/lib for Tomcat 5.5 and
lib for Tomcat 6), since the listener is invoked by Tomcat itself.
The Tomcat deployment tool, ServerXMLConfigurer, deploys the default APA Logging
Listener tag into the server.xml file. The tool is used as part of the
Jetspeed 2 deployment Maven2 plugin, (jetspeed-deploy-maven-plugin), to provide a self
configuring development and demo environment. As noted above, this results in all APA Logging compatible
log files being located in the standard Tomcat installation logs directory.
The deployment tool checks to ensure the listener has not already been installed and/or configured
before running. The Listener tag is inserted within the Engine tag.
Tomcat installation configurations with multiple Engine tags should be configured
manually to ensure proper operation.