syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gwim...@apache.org
Subject syncope git commit: [SYNCOPE-612] explicit configuration of Velocity logging
Date Mon, 01 Dec 2014 09:48:34 GMT
Repository: syncope
Updated Branches:
  refs/heads/1_2_X e414b79be -> f37a1bff9


[SYNCOPE-612] explicit configuration of Velocity logging


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/f37a1bff
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/f37a1bff
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/f37a1bff

Branch: refs/heads/1_2_X
Commit: f37a1bff945b373b4e7d0846a88073916fb9501a
Parents: e414b79
Author: Guido Wimmel <gwimmel@apache.org>
Authored: Mon Dec 1 10:47:02 2014 +0100
Committer: Guido Wimmel <gwimmel@apache.org>
Committed: Mon Dec 1 10:47:02 2014 +0100

----------------------------------------------------------------------
 .../core/util/VelocityEngineFactoryBean.java     | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/f37a1bff/core/src/main/java/org/apache/syncope/core/util/VelocityEngineFactoryBean.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/util/VelocityEngineFactoryBean.java
b/core/src/main/java/org/apache/syncope/core/util/VelocityEngineFactoryBean.java
index 105bf44..f98f073 100644
--- a/core/src/main/java/org/apache/syncope/core/util/VelocityEngineFactoryBean.java
+++ b/core/src/main/java/org/apache/syncope/core/util/VelocityEngineFactoryBean.java
@@ -19,9 +19,11 @@
 package org.apache.syncope.core.util;
 
 import java.io.IOException;
+
 import org.apache.velocity.app.VelocityEngine;
 import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.runtime.RuntimeConstants;
+import org.apache.velocity.runtime.log.CommonsLogLogChute;
 import org.springframework.beans.factory.FactoryBean;
 import org.springframework.beans.factory.InitializingBean;
 import org.springframework.core.io.DefaultResourceLoader;
@@ -35,6 +37,8 @@ public class VelocityEngineFactoryBean implements FactoryBean<VelocityEngine>,
I
 
     private ResourceLoader resourceLoader = new DefaultResourceLoader();
 
+	private boolean overrideLogging = true;
+    
     private VelocityEngine velocityEngine;
 
     public ResourceLoader getResourceLoader() {
@@ -45,7 +49,16 @@ public class VelocityEngineFactoryBean implements FactoryBean<VelocityEngine>,
I
         this.resourceLoader = resourceLoader;
     }
 
-    private void createVelocityEngine() throws IOException, VelocityException {
+    public boolean isOverrideLogging() {
+		return overrideLogging;
+	}
+
+    /** Configure Velocity to use Commons Logging (true by default). */
+	public void setOverrideLogging(boolean overrideLogging) {
+		this.overrideLogging = overrideLogging;
+	}
+
+	private void createVelocityEngine() throws IOException, VelocityException {
         velocityEngine = new VelocityEngine();
 
         velocityEngine.setProperty(
@@ -57,6 +70,10 @@ public class VelocityEngineFactoryBean implements FactoryBean<VelocityEngine>,
I
                 SpringVelocityResourceLoader.SPRING_RESOURCE_LOADER_CACHE, "true");
         velocityEngine.setApplicationAttribute(
                 SpringVelocityResourceLoader.SPRING_RESOURCE_LOADER, getResourceLoader());
+        
+		if (this.overrideLogging) {
+			velocityEngine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, new CommonsLogLogChute());
+		}
 
         velocityEngine.init();
     }


Mime
View raw message