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
This commit is contained in:
Patrick Linskey 2007-08-21 01:20:14 +00:00
parent e26e15496e
commit 8c28c6bcbd
2 changed files with 17 additions and 5 deletions

View File

@ -28,14 +28,15 @@ import javax.persistence.spi.ClassTransformer;
import javax.persistence.spi.PersistenceProvider; import javax.persistence.spi.PersistenceProvider;
import javax.persistence.spi.PersistenceUnitInfo; import javax.persistence.spi.PersistenceUnitInfo;
import org.apache.openjpa.conf.BrokerValue;
import org.apache.openjpa.conf.OpenJPAConfiguration; import org.apache.openjpa.conf.OpenJPAConfiguration;
import org.apache.openjpa.conf.OpenJPAConfigurationImpl; import org.apache.openjpa.conf.OpenJPAConfigurationImpl;
import org.apache.openjpa.conf.BrokerValue;
import org.apache.openjpa.enhance.PCClassFileTransformer; import org.apache.openjpa.enhance.PCClassFileTransformer;
import org.apache.openjpa.kernel.Bootstrap; import org.apache.openjpa.kernel.Bootstrap;
import org.apache.openjpa.kernel.BrokerFactory; import org.apache.openjpa.kernel.BrokerFactory;
import org.apache.openjpa.lib.conf.ConfigurationProvider; import org.apache.openjpa.lib.conf.ConfigurationProvider;
import org.apache.openjpa.lib.conf.Configurations; 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.lib.util.Localizer;
import org.apache.openjpa.meta.MetaDataModes; import org.apache.openjpa.meta.MetaDataModes;
import org.apache.openjpa.meta.MetaDataRepository; import org.apache.openjpa.meta.MetaDataRepository;
@ -117,11 +118,18 @@ public class PersistenceProviderImpl
BrokerFactory factory = Bootstrap.newBrokerFactory(cp, BrokerFactory factory = Bootstrap.newBrokerFactory(cp,
pui.getClassLoader()); pui.getClassLoader());
if (transformerException != null) if (transformerException != null) {
factory.getConfiguration().getLog( Log log = factory.getConfiguration().getLog(
OpenJPAConfiguration.LOG_RUNTIME).warn( OpenJPAConfiguration.LOG_RUNTIME);
_loc.get("transformer-registration-error", pui), if (log.isTraceEnabled()) {
log.warn(
_loc.get("transformer-registration-error-ex", pui),
transformerException); transformerException);
} else {
log.warn(
_loc.get("transformer-registration-error", pui));
}
}
return JPAFacadeHelper.toEntityManagerFactory(factory); return JPAFacadeHelper.toEntityManagerFactory(factory);
} catch (Exception e) { } catch (Exception e) {
throw PersistenceExceptions.toPersistenceException(e); throw PersistenceExceptions.toPersistenceException(e);

View File

@ -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, \ intended for this to be persistent, please add a corresponding setter, \
or switch to field access for this type hierarchy. or switch to field access for this type hierarchy.
transformer-registration-error: An error occurred while registering a \ 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. \ ClassTransformer with {0}. The error is logged along with this warning. \
Load-time class transformation will not be available. Load-time class transformation will not be available.