tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1291232 - in /openejb/trunk/openejb: container/openejb-core/src/main/java/org/apache/openejb/util/ examples/simple-webservice/src/test/java/org/superbiz/calculator/ws/
Date Mon, 20 Feb 2012 12:37:50 GMT
Author: rmannibucau
Date: Mon Feb 20 12:37:49 2012
New Revision: 1291232

URL: http://svn.apache.org/viewvc?rev=1291232&view=rev
Log:
using logging.<property>.<log category name> instead of log category directly
in properties to override jul conf - log category name can still be used directly and is read
before the new property

Modified:
    openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/JuliLogStream.java
    openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/JuliLogStreamFactory.java
    openejb/trunk/openejb/examples/simple-webservice/src/test/java/org/superbiz/calculator/ws/CalculatorTest.java

Modified: openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/JuliLogStream.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/JuliLogStream.java?rev=1291232&r1=1291231&r2=1291232&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/JuliLogStream.java
(original)
+++ openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/JuliLogStream.java
Mon Feb 20 12:37:49 2012
@@ -29,11 +29,11 @@ public class JuliLogStream implements Lo
     public JuliLogStream(LogCategory logCategory) {
         logger = Logger.getLogger(logCategory.getName());
 
-        final String level = logger.getName() + ".level";
-        if (SystemInstance.get().getProperties().containsKey(level)) {
-            final String newLevel = SystemInstance.get().getProperty(level);
+        // if level set through properties force it
+        if (SystemInstance.get().getProperties().containsKey(logger.getName() + ".level")
+                || SystemInstance.get().getProperties().containsKey("logging.level." + logger.getName()))
{
             for (Handler handler : logger.getHandlers()) {
-                handler.setLevel(Level.parse(newLevel));
+                handler.setLevel(logger.getLevel());
             }
         }
     }

Modified: openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/JuliLogStreamFactory.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/JuliLogStreamFactory.java?rev=1291232&r1=1291231&r2=1291232&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/JuliLogStreamFactory.java
(original)
+++ openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/JuliLogStreamFactory.java
Mon Feb 20 12:37:49 2012
@@ -53,10 +53,16 @@ public class JuliLogStreamFactory implem
         @Override
         public String getProperty(final String name) {
             final String parentValue = super.getProperty(name);
+
             if (SystemInstance.get().getProperties().containsKey(name)) {
                 return SystemInstance.get().getProperty(name);
             }
 
+            final String propertyKeyValue = "logging" + reverseProperty(name);
+            if (SystemInstance.get().getProperties().containsKey(propertyKeyValue)) {
+                return SystemInstance.get().getProperty(propertyKeyValue);
+            }
+
             // if it is one of ours loggers and no value is defined let set our nice logging
style
             if (OpenEJBLogManager.class.getName().equals(System.getProperty("java.util.logging.manager"))
// custom logging
                     && isOverridableLogger(name) // managed loggers
@@ -70,6 +76,14 @@ public class JuliLogStreamFactory implem
             return parentValue;
         }
 
+        private static String reverseProperty(String name) {
+            if (name.contains(".") && !name.endsWith(".")) {
+                int idx = name.lastIndexOf('.');
+                return name.substring(idx) + "." + name.substring(0, idx);
+            }
+            return name;
+        }
+
         private static boolean isOverridableLogger(String name) {
             return name.toLowerCase().contains("openejb")
                     || name.toLowerCase().contains("transaction")

Modified: openejb/trunk/openejb/examples/simple-webservice/src/test/java/org/superbiz/calculator/ws/CalculatorTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/examples/simple-webservice/src/test/java/org/superbiz/calculator/ws/CalculatorTest.java?rev=1291232&r1=1291231&r2=1291232&view=diff
==============================================================================
--- openejb/trunk/openejb/examples/simple-webservice/src/test/java/org/superbiz/calculator/ws/CalculatorTest.java
(original)
+++ openejb/trunk/openejb/examples/simple-webservice/src/test/java/org/superbiz/calculator/ws/CalculatorTest.java
Mon Feb 20 12:37:49 2012
@@ -36,7 +36,7 @@ public class CalculatorTest {
         properties.setProperty("openejb.embedded.remotable", "true");
         // properties.setProperty("httpejbd.print", "true");
         // properties.setProperty("httpejbd.indent.xml", "true");
-        // properties.setProperty("OpenEJB.server.http.level", "FINE");
+        // properties.setProperty("logging.level.OpenEJB.server.http", "FINE");
         EJBContainer.createEJBContainer(properties);
     }
 



Mime
View raw message