From 8c28c6bcbd2a4df40197db2a3e49fad68771c450 Mon Sep 17 00:00:00 2001 From: Patrick Linskey Date: Tue, 21 Aug 2007 01:20:14 +0000 Subject: [PATCH] Improved debugging to reduce verbosity when not in TRACE. git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@567896 13f79535-47bb-0310-9956-ffa450edef68 --- .../persistence/PersistenceProviderImpl.java | 18 +++++++++++++----- .../openjpa/persistence/localizer.properties | 4 ++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java index 277d7cf6d..e0b766ce9 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProviderImpl.java @@ -28,14 +28,15 @@ import javax.persistence.spi.ClassTransformer; import javax.persistence.spi.PersistenceProvider; import javax.persistence.spi.PersistenceUnitInfo; +import org.apache.openjpa.conf.BrokerValue; import org.apache.openjpa.conf.OpenJPAConfiguration; import org.apache.openjpa.conf.OpenJPAConfigurationImpl; -import org.apache.openjpa.conf.BrokerValue; import org.apache.openjpa.enhance.PCClassFileTransformer; import org.apache.openjpa.kernel.Bootstrap; import org.apache.openjpa.kernel.BrokerFactory; import org.apache.openjpa.lib.conf.ConfigurationProvider; import org.apache.openjpa.lib.conf.Configurations; +import org.apache.openjpa.lib.log.Log; import org.apache.openjpa.lib.util.Localizer; import org.apache.openjpa.meta.MetaDataModes; import org.apache.openjpa.meta.MetaDataRepository; @@ -117,11 +118,18 @@ public class PersistenceProviderImpl BrokerFactory factory = Bootstrap.newBrokerFactory(cp, pui.getClassLoader()); - if (transformerException != null) - factory.getConfiguration().getLog( - OpenJPAConfiguration.LOG_RUNTIME).warn( - _loc.get("transformer-registration-error", pui), + if (transformerException != null) { + Log log = factory.getConfiguration().getLog( + OpenJPAConfiguration.LOG_RUNTIME); + if (log.isTraceEnabled()) { + log.warn( + _loc.get("transformer-registration-error-ex", pui), transformerException); + } else { + log.warn( + _loc.get("transformer-registration-error", pui)); + } + } return JPAFacadeHelper.toEntityManagerFactory(factory); } catch (Exception e) { throw PersistenceExceptions.toPersistenceException(e); diff --git a/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties b/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties index 4857778d3..c276ef84e 100644 --- a/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties +++ b/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties @@ -126,6 +126,10 @@ no-setter-for-getter: No setter was found for method {0} in type {1} while \ intended for this to be persistent, please add a corresponding setter, \ or switch to field access for this type hierarchy. transformer-registration-error: An error occurred while registering a \ + ClassTransformer with {0}. The error has been consumed. To see it, set \ + your openjpa.Runtime log level to TRACE. Load-time class transformation \ + will not be available. +transformer-registration-error-ex: An error occurred while registering a \ ClassTransformer with {0}. The error is logged along with this warning. \ Load-time class transformation will not be available.