FELIX-598
---------
Fix of a bug introduced at revision 664691.
Logs were not working anymore.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@668561 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/mosgi/jmx.remotelogger/src/main/java/org/apache/felix/mosgi/jmx/remotelogger/Logger.java b/mosgi/jmx.remotelogger/src/main/java/org/apache/felix/mosgi/jmx/remotelogger/Logger.java
index 416f163..3dfa695 100644
--- a/mosgi/jmx.remotelogger/src/main/java/org/apache/felix/mosgi/jmx/remotelogger/Logger.java
+++ b/mosgi/jmx.remotelogger/src/main/java/org/apache/felix/mosgi/jmx/remotelogger/Logger.java
@@ -57,7 +57,6 @@
private static final String[] LOG_LVL=new String[] {"","ERROR ","WARNING ","INFO ","DEBUG "};
private Integer logLvl=new Integer(4);
- private MBeanServer agent=null;
private ObjectName remoteLoggerON=null;
/////////////////////////////////
@@ -97,15 +96,11 @@
case ServiceEvent.REGISTERED :
if (as[0].equals(LogReaderService.class.getName())){
this.registerLogReaderService(servicereference);
- }else if (as[0].equals(MBeanServer.class.getName())){
- //this.registerToAgent(servicereference);
}
break;
case ServiceEvent.UNREGISTERING :
if (as[0].equals(LogReaderService.class.getName())){
this.unRegisterLogReaderService(servicereference);
- }else if (as[0].equals(MBeanServer.class.getName())){
- //this.unRegisterFromAgent();
}
break;
}
@@ -120,7 +115,7 @@
public void logged(LogEntry log, boolean oldLog){
synchronized (logMutex){
- if (log.getLevel() <= logLvl.intValue() & this.agent!=null) {
+ if (log.getLevel() <= logLvl.intValue() ) {
String reg=new String("*");
StringBuffer message=new StringBuffer();
try{
@@ -155,6 +150,11 @@
this.log(LogService.LOG_INFO, "Remote Logger starting "+version);
java.util.Properties p = new java.util.Properties();
+ try {
+ this.remoteLoggerON = new ObjectName(Logger.REMOTE_LOGGER_ON_STRING);
+ } catch (MalformedObjectNameException mne) {
+ throw new BundleException("Logger.Logger:objectName invalid", mne);
+ }
p.put(org.apache.felix.mosgi.jmx.agent.Constants.OBJECTNAME, REMOTE_LOGGER_ON_STRING);
this.mbean_sr = this.bc.registerService(LoggerMBean.class.getName(), this, p);
@@ -180,10 +180,6 @@
this.lrs.removeLogListener(this);
this.bc.removeServiceListener(this);
}
- if (this.agent!=null){
- //this.unRegisterFromAgent();
- }
- this.agent=null;
this.lrs=null;
this.log(LogService.LOG_INFO, "Remote Logger stopped"+version);
this.mbean_sr.unregister();