Author: kmalhi
Date: Mon Sep 10 19:17:56 2007
New Revision: 574433
URL: http://svn.apache.org/viewvc?rev=574433&view=rev
Log:
OpenEJB-675 [Add support for logging being configured externally]
Modified o.a.o.util.Logger to check for a system property named
"openejb.logger.external".
If this property is false, then configure logging according to OpenEJB's
internal rules of configuration
If this property is true, then do nothing i.e. just assume that the external
software (e.g. Geronimo) has done whatever is neccessary to configure log4j
Also changed the name of the configure() method to configureInternal(), just to
be more explicit
Modified:
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/Logger.java
Modified:
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/Logger.java
URL:
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/Logger.java?rev=574433&r1=574432&r2=574433&view=diff
==============================================================================
---
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/Logger.java
(original)
+++
openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/Logger.java
Mon Sep 10 19:17:56 2007
@@ -121,16 +121,18 @@
private static final String EMBEDDED_PROPERTIES_FILE =
"embedded.logging.properties";
static {
try {
- configure();
-
+ String prop =
System.getProperty("openejb.logger.external","false");
+ boolean externalLogging = Boolean.parseBoolean(prop);
+ if(!externalLogging)
+ configureInternal();
} catch (IOException e) {
// The fall back here is that if log4j.configuration system property
is set, then that configuration file will be used.
}
}
- private static void configure() throws IOException {
-
+ private static void configureInternal() throws IOException {
+
System.setProperty("openjpa.Log", "log4j");
SystemInstance system = SystemInstance.get();
FileUtils base = system.getBase();
@@ -154,7 +156,8 @@
configureEmbedded();
}
}
- private static void configureEmbedded(){
+
+ private static void configureEmbedded(){
URL resource =
Thread.currentThread().getContextClassLoader().getResource(EMBEDDED_PROPERTIES_FILE);
if(resource != null)
PropertyConfigurator.configure(resource);