Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Frost2011-06-17 08:02:16 -0400
committerChristopher Frost2011-06-17 08:02:16 -0400
commit5b26846009d6aab8ab72abb5f04f160e46a2ea2d (patch)
tree6922a35868073030537457c672bbeb7d77c481cc
parent91b942093903d07eb5ee5f94f74f5aba3f151421 (diff)
downloadorg.eclipse.virgo.medic-5b26846009d6aab8ab72abb5f04f160e46a2ea2d.tar.gz
org.eclipse.virgo.medic-5b26846009d6aab8ab72abb5f04f160e46a2ea2d.tar.xz
org.eclipse.virgo.medic-5b26846009d6aab8ab72abb5f04f160e46a2ea2d.zip
Formatting improvements and more tests
-rw-r--r--org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/MedicActivator.java3
-rw-r--r--org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/log/osgi/OSGiLogServiceListener.java21
-rw-r--r--org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/log/osgi/VirgoLogFilter.java23
-rw-r--r--org.eclipse.virgo.medic.core/src/test/java/org/eclipse/virgo/medic/log/osgi/OSGiLogServiceListenerTests.java6
4 files changed, 6 insertions, 47 deletions
diff --git a/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/MedicActivator.java b/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/MedicActivator.java
index a2f6054..fbafcf8 100644
--- a/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/MedicActivator.java
+++ b/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/impl/MedicActivator.java
@@ -61,7 +61,6 @@ import org.eclipse.virgo.medic.log.impl.logback.JoranLoggerContextConfigurer;
import org.eclipse.virgo.medic.log.impl.logback.LoggerContextConfigurer;
import org.eclipse.virgo.medic.log.impl.logback.StandardContextSelectorDelegate;
import org.eclipse.virgo.medic.log.osgi.OSGiLogServiceListener;
-import org.eclipse.virgo.medic.log.osgi.VirgoLogFilter;
import org.eclipse.virgo.util.osgi.ServiceRegistrationTracker;
public final class MedicActivator implements BundleActivator {
@@ -112,7 +111,7 @@ public final class MedicActivator implements BundleActivator {
this.logReaderReference = context.getServiceReference(ExtendedLogReaderService.class);
ExtendedLogReaderService logReader = context.getService(this.logReaderReference);
- logReader.addLogListener(new OSGiLogServiceListener(LoggerFactory.getLogger(LogService.class)), new VirgoLogFilter());
+ logReader.addLogListener(new OSGiLogServiceListener(LoggerFactory.getLogger(LogService.class)));
}
public void stop(BundleContext context) throws Exception {
diff --git a/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/log/osgi/OSGiLogServiceListener.java b/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/log/osgi/OSGiLogServiceListener.java
index 6d07d77..1f0d40d 100644
--- a/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/log/osgi/OSGiLogServiceListener.java
+++ b/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/log/osgi/OSGiLogServiceListener.java
@@ -47,12 +47,12 @@ public class OSGiLogServiceListener implements LogListener {
}
private String formatMessage(LogEntry entry){
- String message = String.format("[%s] %s", this.getLevel(entry.getLevel()), entry.getMessage());
+ String message = entry.getMessage();
if(entry.getServiceReference() != null){
- message = String.format("{Service %s}: %s", entry.getServiceReference().getProperty("service.id").toString(), message);
+ message = String.format("Service %s, %s", entry.getServiceReference().getProperty("service.id").toString(), message);
}
if(entry.getBundle() != null){
- message = String.format("{Bundle %s-%s}: %s", entry.getBundle().getSymbolicName(), entry.getBundle().getVersion().toString(), message);
+ message = String.format("Bundle %s_%s, %s", entry.getBundle().getSymbolicName(), entry.getBundle().getVersion().toString(), message);
}
return message;
}
@@ -97,19 +97,4 @@ public class OSGiLogServiceListener implements LogListener {
}
}
- private String getLevel(int level){
- switch (level) {
- case LogService.LOG_DEBUG :
- return "Debug";
- case LogService.LOG_INFO :
- return "Info";
- case LogService.LOG_WARNING :
- return "Warning";
- case LogService.LOG_ERROR :
- return "Error";
- default :
- return "Unknown";
- }
- }
-
}
diff --git a/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/log/osgi/VirgoLogFilter.java b/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/log/osgi/VirgoLogFilter.java
deleted file mode 100644
index 8714d19..0000000
--- a/org.eclipse.virgo.medic.core/src/main/java/org/eclipse/virgo/medic/log/osgi/VirgoLogFilter.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- *
- */
-package org.eclipse.virgo.medic.log.osgi;
-
-import org.eclipse.equinox.log.LogFilter;
-import org.osgi.framework.Bundle;
-
-/**
- * @author cgfrost
- *
- */
-public class VirgoLogFilter implements LogFilter {
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isLoggable(Bundle bundle, String loggerName, int logLevel) {
- return true; //!bundle.getSymbolicName().startsWith("org.eclipse.virgo") && (LogService.LOG_WARNING == logLevel || LogService.LOG_ERROR == logLevel);
- }
-
-}
diff --git a/org.eclipse.virgo.medic.core/src/test/java/org/eclipse/virgo/medic/log/osgi/OSGiLogServiceListenerTests.java b/org.eclipse.virgo.medic.core/src/test/java/org/eclipse/virgo/medic/log/osgi/OSGiLogServiceListenerTests.java
index b5f1734..cf83575 100644
--- a/org.eclipse.virgo.medic.core/src/test/java/org/eclipse/virgo/medic/log/osgi/OSGiLogServiceListenerTests.java
+++ b/org.eclipse.virgo.medic.core/src/test/java/org/eclipse/virgo/medic/log/osgi/OSGiLogServiceListenerTests.java
@@ -24,7 +24,6 @@ import org.eclipse.virgo.teststubs.osgi.framework.StubServiceReference;
import org.eclipse.virgo.teststubs.osgi.framework.StubServiceRegistration;
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
@@ -37,7 +36,6 @@ import org.slf4j.Logger;
*
* OSGiLogServiceImplTests
*/
-@Ignore
public class OSGiLogServiceListenerTests {
private static final String TEST_MESSAGE = "Danger Will Robinson, Danger!!!";
@@ -46,9 +44,9 @@ public class OSGiLogServiceListenerTests {
private static final ServiceReference<Object> SERVICE_REF = new StubServiceReference<Object>(3l, 3, new StubServiceRegistration<Object>(new StubBundleContext(BUNDLE), "org.eclipse.virgo.not.here"));
- private static final String SERVICE_PREFIX = "{Service 3}: ";
+ private static final String SERVICE_PREFIX = "Service 3, ";
- private static final String BUNDLE_PREFIX = "{Bundle org.eclipse.virgo.not.here-0.0.0}: ";
+ private static final String BUNDLE_PREFIX = "Bundle org.eclipse.virgo.not.here_0.0.0, ";
private static final String INVALID_PREFIX = "Log Message of unknown severity 99: ";

Back to the top