mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 12:35:22 +02:00
[refactor] add logging capability to core plugin
in preparation for moving some persistence classes
This commit is contained in:
parent
140cb9a9fe
commit
698c707f7c
2 changed files with 12 additions and 1 deletions
|
@ -6,7 +6,8 @@ Bundle-Version: 1.0.0.qualifier
|
||||||
Bundle-Activator: org.eclipse.rse.core.RSECorePlugin
|
Bundle-Activator: org.eclipse.rse.core.RSECorePlugin
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
Require-Bundle: org.eclipse.core.runtime,
|
Require-Bundle: org.eclipse.core.runtime,
|
||||||
org.eclipse.core.resources
|
org.eclipse.core.resources,
|
||||||
|
org.eclipse.rse.logging
|
||||||
Eclipse-LazyStart: true
|
Eclipse-LazyStart: true
|
||||||
Export-Package: org.eclipse.rse.core,
|
Export-Package: org.eclipse.rse.core,
|
||||||
org.eclipse.rse.core.filters,
|
org.eclipse.rse.core.filters,
|
||||||
|
|
|
@ -22,6 +22,8 @@ import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Plugin;
|
import org.eclipse.core.runtime.Plugin;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.rse.core.internal.RSECoreRegistry;
|
import org.eclipse.rse.core.internal.RSECoreRegistry;
|
||||||
|
import org.eclipse.rse.logging.Logger;
|
||||||
|
import org.eclipse.rse.logging.LoggerFactory;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,6 +33,7 @@ public class RSECorePlugin extends Plugin {
|
||||||
|
|
||||||
// the shared instance
|
// the shared instance
|
||||||
private static RSECorePlugin plugin;
|
private static RSECorePlugin plugin;
|
||||||
|
private Logger logger = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the local machine name
|
* @return the local machine name
|
||||||
|
@ -70,6 +73,7 @@ public class RSECorePlugin extends Plugin {
|
||||||
*/
|
*/
|
||||||
public void start(BundleContext context) throws Exception {
|
public void start(BundleContext context) throws Exception {
|
||||||
super.start(context);
|
super.start(context);
|
||||||
|
logger = LoggerFactory.getLogger(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,6 +81,8 @@ public class RSECorePlugin extends Plugin {
|
||||||
*/
|
*/
|
||||||
public void stop(BundleContext context) throws Exception {
|
public void stop(BundleContext context) throws Exception {
|
||||||
super.stop(context);
|
super.stop(context);
|
||||||
|
LoggerFactory.freeLogger(this);
|
||||||
|
logger = null;
|
||||||
plugin = null;
|
plugin = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,6 +103,10 @@ public class RSECorePlugin extends Plugin {
|
||||||
return RSECoreRegistry.getDefault();
|
return RSECoreRegistry.getDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Logger getLogger() {
|
||||||
|
return logger;
|
||||||
|
}
|
||||||
|
|
||||||
private void log(Throwable t) {
|
private void log(Throwable t) {
|
||||||
String pluginId = this.getBundle().getSymbolicName();
|
String pluginId = this.getBundle().getSymbolicName();
|
||||||
IStatus status = new Status(IStatus.ERROR, pluginId, 0, "Unexpected Exception", t);
|
IStatus status = new Status(IStatus.ERROR, pluginId, 0, "Unexpected Exception", t);
|
||||||
|
|
Loading…
Add table
Reference in a new issue