From 0dce2ee5987e4e086e012ab7c2739638ac80f1c5 Mon Sep 17 00:00:00 2001 From: pb Date: Wed, 27 May 2009 15:26:07 +0000 Subject: [PATCH] Activated user accessible log4j configuration file. In addition, file location is now configurable using a new web.xml context parameter. git-svn-id: https://svn.libreccm.org/ccm/trunk@183 8810af33-2d31-482b-a856-94f89814c4df --- .../com/arsdigita/logging/ErrorReport.java | 7 ++- .../logging/examples/LogExample.java | 12 +++-- .../logging/examples/LogExampleThread.java | 4 +- .../arsdigita/logging/examples/package.html | 8 ++-- .../src/com/arsdigita/logging/package.html | 9 ++-- .../com/arsdigita/packaging/MasterTool.java | 3 +- .../arsdigita/runtime/CCMResourceManager.java | 37 +++++---------- .../src/com/arsdigita/runtime/Startup.java | 33 ++----------- ccm-core/src/com/arsdigita/util/Assert.java | 8 ++-- .../arsdigita/web/BaseApplicationServlet.java | 18 +++++-- .../src/com/arsdigita/web/BaseFilter.java | 38 +++++++++++---- ccm-core/src/com/arsdigita/web/BaseJSP.java | 1 + .../src/com/arsdigita/web/BaseServlet.java | 14 ++---- .../web/CCMApplicationContextListener.java | 47 +++++++++++++++++-- ccm-core/src/log4j.properties | 8 +++- ccm-core/web/WEB-INF/web.xml-core | 7 +++ ccm-ldn-aplaws/bundles/complete/cfg/web.xml | 8 ++++ ccm-ldn-aplaws/bundles/demo/cfg/web.xml | 8 ++++ ccm-ldn-aplaws/bundles/devel/cfg/web.xml | 8 ++++ ccm-ldn-aplaws/bundles/standard/cfg/web.xml | 8 ++++ ccm-shp-aplaws/bundles/devel/cfg/web.xml | 8 ++++ ccm-zes-aplaws/bundles/devel/cfg/web.xml | 8 ++++ 22 files changed, 198 insertions(+), 104 deletions(-) diff --git a/ccm-core/src/com/arsdigita/logging/ErrorReport.java b/ccm-core/src/com/arsdigita/logging/ErrorReport.java index 3635c17d7..f1cb5c12f 100755 --- a/ccm-core/src/com/arsdigita/logging/ErrorReport.java +++ b/ccm-core/src/com/arsdigita/logging/ErrorReport.java @@ -24,6 +24,7 @@ import com.arsdigita.util.JavaPropertyReader; import com.arsdigita.util.parameter.ErrorList; import com.arsdigita.util.parameter.Parameter; import com.arsdigita.util.parameter.StringParameter; + import java.io.File; import java.io.PrintWriter; import java.io.StringWriter; @@ -35,6 +36,7 @@ import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; import java.util.TreeSet; + import org.apache.log4j.Logger; /** @@ -50,7 +52,8 @@ import org.apache.log4j.Logger; * * * @author Dan Berrange - * @see http://www.tuxedo.org/~esr/jargon/html/entry/guru-meditation.html + * @see + * http://www.tuxedo.org/~esr/jargon/html/entry/guru-meditation.html */ public class ErrorReport { public static final String versionId = @@ -79,7 +82,7 @@ public class ErrorReport { } public static void initializeAppender(String directory) { - Assert.assertNotNull(directory, "directory is null"); + Assert.exists(directory, "directory is null"); File file = new File(directory); if (!file.exists()) { diff --git a/ccm-core/src/com/arsdigita/logging/examples/LogExample.java b/ccm-core/src/com/arsdigita/logging/examples/LogExample.java index f6bee11f4..ee9c7ced9 100755 --- a/ccm-core/src/com/arsdigita/logging/examples/LogExample.java +++ b/ccm-core/src/com/arsdigita/logging/examples/LogExample.java @@ -33,7 +33,9 @@ import org.apache.log4j.RollingFileAppender; * @version $Revision: #9 $ $Date: 2004/08/16 $ */ public class LogExample { - public final static String versionId = "$Id: LogExample.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; + public final static String versionId = + "$Id: LogExample.java 287 2005-02-22 00:29:02Z sskracic $" + + " by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; // get the logger named the same as this class static final Logger cat = Logger.getLogger(LogExample.class); @@ -45,10 +47,10 @@ public class LogExample { try { // create a rolling file appender with standard layout RollingFileAppender rfa = new RollingFileAppender( - new PatternLayout( - PatternLayout.TTCC_CONVERSION_PATTERN - ), filename - ); + new PatternLayout( + PatternLayout.TTCC_CONVERSION_PATTERN + ), filename + ); // add our secure log filter to this appender so that it // won't get any of the secure log messages diff --git a/ccm-core/src/com/arsdigita/logging/examples/LogExampleThread.java b/ccm-core/src/com/arsdigita/logging/examples/LogExampleThread.java index af759ad1a..337d1173b 100755 --- a/ccm-core/src/com/arsdigita/logging/examples/LogExampleThread.java +++ b/ccm-core/src/com/arsdigita/logging/examples/LogExampleThread.java @@ -29,7 +29,9 @@ import org.apache.log4j.Logger; * @version $Revision: #10 $ $Date: 2004/08/16 $ */ public class LogExampleThread extends Thread { - public final static String versionId = "$Id: LogExampleThread.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; + public final static String + versionId = "$Id: LogExampleThread.java 287 2005-02-22 00:29:02Z sskracic $" + + " by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $"; // get the category named the same as this class private static final Logger cat = Logger.getLogger(LogExampleThread.class); diff --git a/ccm-core/src/com/arsdigita/logging/examples/package.html b/ccm-core/src/com/arsdigita/logging/examples/package.html index f8489e0fe..fbc2dc88b 100755 --- a/ccm-core/src/com/arsdigita/logging/examples/package.html +++ b/ccm-core/src/com/arsdigita/logging/examples/package.html @@ -5,12 +5,10 @@ -

+

Contains example code to demonstrate proper usage of +the ACS Logging system.

-Example Contains example code to demonstrate proper usage of -the ACS Logging system. - -

+ diff --git a/ccm-core/src/com/arsdigita/logging/package.html b/ccm-core/src/com/arsdigita/logging/package.html index 4a1f302b7..4ab2177f2 100755 --- a/ccm-core/src/com/arsdigita/logging/package.html +++ b/ccm-core/src/com/arsdigita/logging/package.html @@ -6,11 +6,14 @@

- Extends the Log4j -framework to support secure logging. - +framework to support secure logging. In case of an error it generates an +error page for the user which contains a unique reference code. Is is meant to +be used to search for the error message in the log files. In addition is +generates a formated log entry with a lot of additional information about the +system's state.

+ diff --git a/ccm-core/src/com/arsdigita/packaging/MasterTool.java b/ccm-core/src/com/arsdigita/packaging/MasterTool.java index a29b95914..1ec6c68a4 100755 --- a/ccm-core/src/com/arsdigita/packaging/MasterTool.java +++ b/ccm-core/src/com/arsdigita/packaging/MasterTool.java @@ -84,7 +84,8 @@ public class MasterTool { final PrintStream out = System.out; final PrintStream err = System.err; - com.arsdigita.runtime.Startup.startup(); + // nolonger needed + // com.arsdigita.runtime.Startup.startup(); Commands cmds = new Commands(); Command help = new Help(); diff --git a/ccm-core/src/com/arsdigita/runtime/CCMResourceManager.java b/ccm-core/src/com/arsdigita/runtime/CCMResourceManager.java index ac9d479f2..fe731bd27 100755 --- a/ccm-core/src/com/arsdigita/runtime/CCMResourceManager.java +++ b/ccm-core/src/com/arsdigita/runtime/CCMResourceManager.java @@ -20,14 +20,16 @@ package com.arsdigita.runtime; import com.arsdigita.util.UncheckedWrapperException; + import java.io.File; import java.net.MalformedURLException; import java.net.URL; + import org.apache.log4j.Logger; /** *

CCMResourceManager Runtime environment repository object, stores essential - * properties of the runtime environment.

+ * properties of the runtime environment and provides them on request.

* *

Currently, is is limited to the

*