[jboss-cvs] JBossAS SVN: r101653 - projects/jboss-osgi/projects/bundles/jmx/trunk.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Mar 1 08:06:12 EST 2010


Author: thomas.diesler at jboss.com
Date: 2010-03-01 08:06:11 -0500 (Mon, 01 Mar 2010)
New Revision: 101653

Added:
   projects/jboss-osgi/projects/bundles/jmx/trunk/ARIES-206-20100227.patch
Log:
Add Aries patch

Added: projects/jboss-osgi/projects/bundles/jmx/trunk/ARIES-206-20100227.patch
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/ARIES-206-20100227.patch	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/ARIES-206-20100227.patch	2010-03-01 13:06:11 UTC (rev 101653)
@@ -0,0 +1,85 @@
+Index: jmx-core/src/main/java/org/apache/aries/jmx/Logger.java
+===================================================================
+--- jmx-core/src/main/java/org/apache/aries/jmx/Logger.java	(revision 916848)
++++ jmx-core/src/main/java/org/apache/aries/jmx/Logger.java	(working copy)
+@@ -16,6 +16,7 @@
+  */
+ package org.apache.aries.jmx;
+ 
++import org.osgi.framework.Bundle;
+ import org.osgi.framework.BundleContext;
+ import org.osgi.framework.ServiceReference;
+ import org.osgi.service.log.LogService;
+@@ -32,6 +33,7 @@
+ public class Logger extends ServiceTracker implements LogService {
+     
+     private String bundleLocation;
++    private Bundle bundle;
+ 
+     /**
+      * Constructs new Logger(ServiceTracker for LogService).
+@@ -41,6 +43,7 @@
+     public Logger(BundleContext context) {
+         super(context, LogService.class.getName(), null);
+         this.bundleLocation = context.getBundle().getLocation();
++        this.bundle = context.getBundle();
+     }
+ 
+     /**
+@@ -51,9 +54,8 @@
+         if (logService != null) {
+             logService.log(level, message);
+         } else {
+-            System.err.println("[" + bundleLocation + ":" + level + "] " + message);
++           syslog(level, message, null);
+         }
+-
+     }
+ 
+     /**
+@@ -64,8 +66,7 @@
+         if (logService != null) {
+             logService.log(level, message, exception);
+         } else {
+-            System.err.println("[" + bundleLocation + ":" + +level + "] " + message
+-                    + ((exception == null) ? " " : exception.toString()));
++            syslog(level, message, exception);
+         }
+     }
+ 
+@@ -77,8 +78,7 @@
+         if (logService != null) {
+             logService.log(ref, level, message);
+         } else {
+-            System.err.println("[" + bundleLocation + ":" + ((ref == null) ? " " : (ref + ":"))
+-                    + level + "] " + message);
++           syslog(ref, level, message, null);
+         }
+     }
+ 
+@@ -91,9 +91,23 @@
+         if (logService != null) {
+             logService.log(ref, level, message, exception);
+         } else {
+-            System.err.println("[" + bundleLocation + ":" + ((ref == null) ? "" : (ref + ":"))
+-                    + level + "] " + message + ((exception == null) ? " " : exception.toString()));
++            syslog(ref, level, message, exception);
+         }
+     }
+ 
++    private void syslog(int level, String message, Throwable exception)
++    {
++       if (bundle.getState() == Bundle.ACTIVE || exception != null) {
++          System.err.println("[" + bundleLocation + ":" + +level + "] " + message
++                + ((exception == null) ? " " : exception.toString()));
++       }
++    }
++
++    private void syslog(ServiceReference ref, int level, String message, Throwable exception)
++    {
++       if (bundle.getState() == Bundle.ACTIVE || exception != null) {
++           System.err.println("[" + bundleLocation + ":" + ((ref == null) ? "" : (ref + ":"))
++              + level + "] " + message + ((exception == null) ? " " : exception.toString()));
++       }
++    }
+ }




More information about the jboss-cvs-commits mailing list