Return-Path: X-Original-To: apmail-syncope-commits-archive@www.apache.org Delivered-To: apmail-syncope-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7CC2810492 for ; Mon, 1 Dec 2014 09:48:35 +0000 (UTC) Received: (qmail 58954 invoked by uid 500); 1 Dec 2014 09:48:35 -0000 Delivered-To: apmail-syncope-commits-archive@syncope.apache.org Received: (qmail 58924 invoked by uid 500); 1 Dec 2014 09:48:35 -0000 Mailing-List: contact commits-help@syncope.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@syncope.apache.org Delivered-To: mailing list commits@syncope.apache.org Received: (qmail 58915 invoked by uid 99); 1 Dec 2014 09:48:35 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Dec 2014 09:48:35 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id BFFAB98806A; Mon, 1 Dec 2014 09:48:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: gwimmel@apache.org To: commits@syncope.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: syncope git commit: [SYNCOPE-612] explicit configuration of Velocity logging Date: Mon, 1 Dec 2014 09:48:34 +0000 (UTC) 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 Authored: Mon Dec 1 10:47:02 2014 +0100 Committer: Guido Wimmel 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, 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, 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, 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(); }