cziegeler 01/08/09 05:24:02
Modified: src/org/apache/cocoon/servlet Tag: cocoon_20_branch
CocoonServlet.java
webapp/WEB-INF Tag: cocoon_20_branch web.xml
Added: src/org/apache/cocoon/util/log Tag: cocoon_20_branch
XMLCocoonLogFormatter.java
Log:
Added simple xml log formatter and configuration option in web.xml
Revision Changes Path
No revision
No revision
1.13.2.12 +14 -4 xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java
Index: CocoonServlet.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java,v
retrieving revision 1.13.2.11
retrieving revision 1.13.2.12
diff -u -r1.13.2.11 -r1.13.2.12
--- CocoonServlet.java 2001/08/08 09:55:39 1.13.2.11
+++ CocoonServlet.java 2001/08/09 12:24:02 1.13.2.12
@@ -43,7 +43,9 @@
import org.apache.cocoon.util.IOUtils;
import org.apache.cocoon.util.NetUtils;
import org.apache.cocoon.util.log.CocoonLogFormatter;
+import org.apache.cocoon.util.log.XMLCocoonLogFormatter;
import org.apache.log.ContextStack;
+import org.apache.log.Formatter;
import org.apache.log.Hierarchy;
import org.apache.log.LogTarget;
import org.apache.log.Logger;
@@ -62,7 +64,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> Aisa
* @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
- * @version CVS $Revision: 1.13.2.11 $ $Date: 2001/08/08 09:55:39 $
+ * @version CVS $Revision: 1.13.2.12 $ $Date: 2001/08/09 12:24:02 $
*/
public class CocoonServlet extends HttpServlet {
@@ -305,6 +307,7 @@
final Priority logPriority;
String logDir = getInitParameter("log-dir");
String logLevel = getInitParameter("log-level");
+ String logFormat = getInitParameter("log-format");
if (logLevel != null) {
logLevel.trim();
}
@@ -335,10 +338,17 @@
this.appContext.put(Constants.CONTEXT_LOG_FILE, logName);
final String path = logDir + logName;
- final CocoonLogFormatter formatter = new CocoonLogFormatter();
- formatter.setFormat( "%7.7{priority} %{time} [%8.8{category}] " +
+ Formatter formatter;
+ if (logFormat == null || logFormat.equalsIgnoreCase("xml") == false) {
+ final CocoonLogFormatter cf = new CocoonLogFormatter();
+ cf.setFormat( "%7.7{priority} %{time} [%8.8{category}] " +
"(%{uri}) %{thread}/%{class:short}:
%{message}\\n%{throwable}" );
-
+ formatter = cf;
+ } else {
+ final XMLCocoonLogFormatter cf = new XMLCocoonLogFormatter();
+ cf.setTypes("priority time category uri thread class message
throwable");
+ formatter = cf;
+ }
this.log = Hierarchy.getDefaultHierarchy().getLoggerFor("cocoon");
this.log.setPriority(logPriority);
No revision
No revision
1.1.2.1 +340 -0
xml-cocoon2/src/org/apache/cocoon/util/log/Attic/XMLCocoonLogFormatter.java
No revision
No revision
1.1.1.1.2.6 +11 -1 xml-cocoon2/webapp/WEB-INF/web.xml
Index: web.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/webapp/WEB-INF/web.xml,v
retrieving revision 1.1.1.1.2.5
retrieving revision 1.1.1.1.2.6
diff -u -r1.1.1.1.2.5 -r1.1.1.1.2.6
--- web.xml 2001/07/19 18:33:44 1.1.1.1.2.5
+++ web.xml 2001/08/09 12:24:02 1.1.1.1.2.6
@@ -88,6 +88,16 @@
-->
<!--
+ This parameter specifies the format of the log. You can choose between xml
+ and text, default is text.
+
+ <init-param>
+ <param-name>log-format</param-name>
+ <param-value>xml</param-value>
+ </init-param>
+ -->
+
+ <!--
Allow reinstantiating (reloading) of the cocoon instance. If this is
set to "yes" or "true", a new cocoon instance can be created using
the request parameter "cocoon-reload".
@@ -153,7 +163,7 @@
This parameter allows to specify additional directories or jars
which Cocoon should put into it's own classpath.
Note that you must separate them using the platforms path.separator
- (":" for *nix and ";" for Windows systems). Also not that absolute
+ (":" for *nix and ";" for Windows systems). Also note that absolute
pathes are take as such but relative pathes are rooted at the context
root of the Cocoon servlet.
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]