summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Campo2008-02-11 10:32:12 (EST)
committerChristian Campo2008-02-11 10:32:12 (EST)
commit93c5553aa373d85f2d7d378760780c6ee47c6ac1 (patch)
tree55210019ca27432519a25068d73927c14e5fbee7
parent3f9e45c4065ddf2482ff187d7b7363af56840cdc (diff)
downloadorg.eclipse.riena-93c5553aa373d85f2d7d378760780c6ee47c6ac1.zip
org.eclipse.riena-93c5553aa373d85f2d7d378760780c6ee47c6ac1.tar.gz
org.eclipse.riena-93c5553aa373d85f2d7d378760780c6ee47c6ac1.tar.bz2
logging only added once so each message only displays once.....equinox.log and equinox.cm are forced to start
-rw-r--r--org.eclipse.riena.core/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.riena.core/src/org/eclipse/riena/core/logging/LogUtil.java14
-rw-r--r--org.eclipse.riena.core/src/org/eclipse/riena/core/logging/SysoLogListener.java25
-rw-r--r--org.eclipse.riena.core/src/org/eclipse/riena/internal/core/Activator.java10
-rw-r--r--org.eclipse.riena.sample.app.server/Riena Sample App Server.launch2
5 files changed, 40 insertions, 14 deletions
diff --git a/org.eclipse.riena.core/META-INF/MANIFEST.MF b/org.eclipse.riena.core/META-INF/MANIFEST.MF
index bc059a7..14187e1 100644
--- a/org.eclipse.riena.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.riena.core/META-INF/MANIFEST.MF
@@ -5,8 +5,7 @@ Bundle-SymbolicName: org.eclipse.riena.core;singleton:=true
Bundle-Version: 0.0.1
Bundle-Activator: org.eclipse.riena.internal.core.Activator
Eclipse-LazyStart: true
-Import-Package: org.eclipse.equinox.log,
- org.osgi.framework;version="1.3.0",
+Import-Package: org.osgi.framework;version="1.3.0",
org.osgi.service.cm;version="1.2.0",
org.osgi.service.log;version="1.3.0"
Export-Package: org.eclipse.riena.core,
diff --git a/org.eclipse.riena.core/src/org/eclipse/riena/core/logging/LogUtil.java b/org.eclipse.riena.core/src/org/eclipse/riena/core/logging/LogUtil.java
index a44917f..a70d4c1 100644
--- a/org.eclipse.riena.core/src/org/eclipse/riena/core/logging/LogUtil.java
+++ b/org.eclipse.riena.core/src/org/eclipse/riena/core/logging/LogUtil.java
@@ -23,9 +23,9 @@ import org.osgi.service.log.LogService;
*/
public class LogUtil {
- private ExtendedLogService logService;
+ private static ExtendedLogService logService;
private ExtendedLogReaderService logReaderService;
- private boolean initialized = false;
+ private static boolean initialized = false;
private BundleContext context;
public LogUtil(BundleContext context) {
@@ -50,8 +50,8 @@ public class LogUtil {
*
* @param logService
*/
- public void bindLogService(LogService logService) {
- this.logService = (ExtendedLogService) logService;
+ public void bindLogService(LogService logServiceParm) {
+ logService = (ExtendedLogService) logServiceParm;
}
/**
@@ -59,9 +59,9 @@ public class LogUtil {
*
* @param logService
*/
- public void unbindLogService(LogService logService) {
- if (this.logService == logService) {
- this.logService = null;
+ public void unbindLogService(LogService logServiceParm) {
+ if (logService == logServiceParm) {
+ logService = null;
}
}
diff --git a/org.eclipse.riena.core/src/org/eclipse/riena/core/logging/SysoLogListener.java b/org.eclipse.riena.core/src/org/eclipse/riena/core/logging/SysoLogListener.java
index 47ded84..16e5a9f 100644
--- a/org.eclipse.riena.core/src/org/eclipse/riena/core/logging/SysoLogListener.java
+++ b/org.eclipse.riena.core/src/org/eclipse/riena/core/logging/SysoLogListener.java
@@ -15,6 +15,7 @@ import java.util.Date;
import org.eclipse.equinox.log.ExtendedLogEntry;
import org.osgi.service.log.LogEntry;
import org.osgi.service.log.LogListener;
+import org.osgi.service.log.LogService;
public class SysoLogListener implements LogListener {
@@ -22,9 +23,29 @@ public class SysoLogListener implements LogListener {
ExtendedLogEntry eEntry = (ExtendedLogEntry) entry;
StringBuffer buffer = new StringBuffer();
buffer.append(new Date(eEntry.getTime()).toString()).append(' ');
- buffer.append(eEntry.getLevel()).append(' ');
+ String level;
+ switch (eEntry.getLevel()) {
+ case LogService.LOG_DEBUG:
+ level = "DEBUG";
+ break;
+ case LogService.LOG_WARNING:
+ level = "WARNING";
+ break;
+ case LogService.LOG_ERROR:
+ level = "ERROR";
+ break;
+ case LogService.LOG_INFO:
+ level = "INFO";
+ break;
+ default:
+ level = "UNKNOWN";
+ break;
+ }
+ buffer.append(level).append(' ');
buffer.append(eEntry.getLoggerName()).append(' ');
- buffer.append(eEntry.getContext()).append(' ');
+ if (eEntry.getContext() != null) {
+ buffer.append(eEntry.getContext()).append(' ');
+ }
buffer.append(entry.getMessage());
System.out.println(buffer.toString());
if (eEntry.getException() != null) {
diff --git a/org.eclipse.riena.core/src/org/eclipse/riena/internal/core/Activator.java b/org.eclipse.riena.core/src/org/eclipse/riena/internal/core/Activator.java
index c01bbce..8147ed4 100644
--- a/org.eclipse.riena.core/src/org/eclipse/riena/internal/core/Activator.java
+++ b/org.eclipse.riena.core/src/org/eclipse/riena/internal/core/Activator.java
@@ -50,6 +50,10 @@ public class Activator extends Plugin {
Bundle[] bundles = context.getBundles();
for (Bundle bundle : bundles) {
String forceStart = (String) bundle.getHeaders().get("Riena-ForceStart");
+ if (bundle.getSymbolicName().equals("org.eclipse.equinox.cm")
+ || bundle.getSymbolicName().equals("org.eclipse.equinox.log")) {
+ forceStart = "true";
+ }
if (forceStart != null && forceStart.equals("true")) {
// STARTING == LAZY, so start that also
if (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.STARTING) {
@@ -57,10 +61,12 @@ public class Activator extends Plugin {
System.out.println(bundle.getSymbolicName() + " forced autostart successfully");
} else {
if (bundle.getState() == Bundle.INSTALLED) {
- System.err.println(bundle.getSymbolicName() + " has Riena-ForceStart but is only in state INSTALLED (not RESOLVED).");
+ System.err.println(bundle.getSymbolicName()
+ + " has Riena-ForceStart but is only in state INSTALLED (not RESOLVED).");
} else {
if (bundle.getState() == Bundle.ACTIVE) {
- System.out.println(bundle.getSymbolicName() + " no forced autostart. Bundle is already ACTIVE.");
+ System.out.println(bundle.getSymbolicName()
+ + " no forced autostart. Bundle is already ACTIVE.");
}
}
}
diff --git a/org.eclipse.riena.sample.app.server/Riena Sample App Server.launch b/org.eclipse.riena.sample.app.server/Riena Sample App Server.launch
index 544929c..8455db0 100644
--- a/org.eclipse.riena.sample.app.server/Riena Sample App Server.launch
+++ b/org.eclipse.riena.sample.app.server/Riena Sample App Server.launch
@@ -18,5 +18,5 @@
<stringAttribute key="target_bundles" value="javax.servlet@default:default,org.apache.commons.logging@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.osgi@:,org.eclipse.osgi.services@default:default,org.mortbay.jetty@default:default"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useDefaultConfigArea" value="true"/>
-<stringAttribute key="workspace_bundles" value="com.caucho.hessian@default:default,org.apache.log4j@default:default,org.eclipse.core.runtime.compatibility.registry@default:default,org.eclipse.equinox.cm@default:default,org.eclipse.equinox.log@default:default,org.eclipse.equinox.log@default:default,org.eclipse.riena.communication.console@default:default,org.eclipse.riena.communication.core@default:default,org.eclipse.riena.communication.publisher@default:default,org.eclipse.riena.communication.publisher.hessian@5:default,org.eclipse.riena.core@default:default,org.eclipse.riena.sample.app.common@6:default,org.eclipse.riena.sample.app.server@6:default,org.eclipse.riena.security.common@default:default,org.junit@default:default"/>
+<stringAttribute key="workspace_bundles" value="com.caucho.hessian@default:default,org.apache.log4j@default:default,org.eclipse.equinox.cm@default:default,org.eclipse.equinox.log@default:default,org.eclipse.riena.communication.console@default:default,org.eclipse.riena.communication.core@default:default,org.eclipse.riena.communication.publisher@default:default,org.eclipse.riena.communication.publisher.hessian@5:default,org.eclipse.riena.core@default:default,org.eclipse.riena.sample.app.common@6:default,org.eclipse.riena.sample.app.server@6:default,org.eclipse.riena.security.common@default:default"/>
</launchConfiguration>