cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r492553 - in /cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator: pom.xml src/main/java/org/apache/cocoon/spring/configurator/log4j/ src/main/java/org/apache/cocoon/spring/configurator/log4j/Log4JConfigurator.java
Date Thu, 04 Jan 2007 12:56:02 GMT
Author: cziegeler
Date: Thu Jan  4 04:56:01 2007
New Revision: 492553

URL: http://svn.apache.org/viewvc?view=rev&rev=492553
Log:
Add support for log4j

Added:
    cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/src/main/java/org/apache/cocoon/spring/configurator/log4j/
    cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/src/main/java/org/apache/cocoon/spring/configurator/log4j/Log4JConfigurator.java
  (with props)
Modified:
    cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/pom.xml

Modified: cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/pom.xml?view=diff&rev=492553&r1=492552&r2=492553
==============================================================================
--- cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/pom.xml (original)
+++ cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/pom.xml Thu Jan  4 04:56:01
2007
@@ -59,6 +59,12 @@
       </exclusions>
     </dependency>
     <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>1.2.14</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
       <groupId>javax.servlet</groupId>
       <artifactId>servlet-api</artifactId>
       <version>2.4</version>

Added: cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/src/main/java/org/apache/cocoon/spring/configurator/log4j/Log4JConfigurator.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/src/main/java/org/apache/cocoon/spring/configurator/log4j/Log4JConfigurator.java?view=auto&rev=492553
==============================================================================
--- cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/src/main/java/org/apache/cocoon/spring/configurator/log4j/Log4JConfigurator.java
(added)
+++ cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/src/main/java/org/apache/cocoon/spring/configurator/log4j/Log4JConfigurator.java
Thu Jan  4 04:56:01 2007
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed  under the  License is distributed on an "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.spring.configurator.log4j;
+
+import org.apache.cocoon.configuration.PropertyHelper;
+import org.apache.cocoon.configuration.Settings;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.xml.DOMConfigurator;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.core.io.Resource;
+
+/**
+ * This is a configurator for log4j that supports variable substitution
+ * from the settings object.
+ *
+ * @version $Id$
+ * @since 1.0
+ */
+public class Log4JConfigurator
+    extends DOMConfigurator
+    implements InitializingBean {
+
+    /** The settings object that is used to substitute variable values. */
+    protected Settings settings;
+
+    /** The configuration resources. */
+    protected Resource resource;
+
+    public void setSettings(Settings s) {
+        this.settings = s;
+    }
+
+    public void setResource(Resource r) {
+        this.resource = r;        
+    }
+
+    /**
+     * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
+     */
+    public void afterPropertiesSet() throws Exception {
+        this.doConfigure(this.resource.getInputStream(), LogManager.getLoggerRepository());
+    }
+
+    /**
+     * @see org.apache.log4j.xml.DOMConfigurator#subst(java.lang.String)
+     */
+    protected String subst(String value) {
+        return PropertyHelper.replace(value, this.settings);
+    }  
+}

Propchange: cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/src/main/java/org/apache/cocoon/spring/configurator/log4j/Log4JConfigurator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/core/cocoon-configuration/cocoon-spring-configurator/src/main/java/org/apache/cocoon/spring/configurator/log4j/Log4JConfigurator.java
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message