use of org.osgi.service.log.LogService in project ecf by eclipse.
the class LogTracker method log.
public synchronized void log(ServiceReference reference, int level, String message, Throwable exception) {
ServiceReference[] references = getServiceReferences();
if (references != null) {
int size = references.length;
for (int i = 0; i < size; i++) {
LogService service = (LogService) getService(references[i]);
if (service != null) {
try {
service.log(reference, level, message, exception);
} catch (Exception e) {
// TODO: consider printing to System Error
}
}
}
return;
}
noLogService(level, message, exception, reference);
}
use of org.osgi.service.log.LogService in project ecf by eclipse.
the class Activator method getLogService.
protected LogService getLogService() {
if (logServiceTracker == null) {
logServiceTracker = new ServiceTracker(this.context, LogService.class.getName(), null);
logServiceTracker.open();
}
return (LogService) logServiceTracker.getService();
}
use of org.osgi.service.log.LogService in project ecf by eclipse.
the class ProviderPlugin method getLogService.
@SuppressWarnings("unchecked")
protected LogService getLogService() {
if (context == null) {
if (systemLogService == null)
systemLogService = new SystemLogService(PLUGIN_ID);
return systemLogService;
}
if (logServiceTracker == null) {
logServiceTracker = new ServiceTracker(this.context, LogService.class.getName(), null);
logServiceTracker.open();
}
return (LogService) logServiceTracker.getService();
}
use of org.osgi.service.log.LogService in project ecf by eclipse.
the class ChannelEndpointImpl method stopTiming.
void stopTiming(String message, Throwable exception) {
if (TRACE_TIME) {
StringBuffer buf = new StringBuffer("TIMING.END;");
buf.append(sdf.format(new Date(startTime))).append(";");
buf.append((message == null ? "" : message));
buf.append(";duration(ms)=").append((System.currentTimeMillis() - startTime));
LogService logService = RemoteOSGiServiceImpl.log;
if (logService != null && USE_LOG_SERVICE) {
if (exception != null)
logService.log(LogService.LOG_ERROR, buf.toString(), exception);
else
logService.log(LogService.LOG_INFO, buf.toString());
} else {
System.out.println(buf.toString());
if (exception != null)
exception.printStackTrace();
}
startTime = 0;
}
}
use of org.osgi.service.log.LogService in project ecf by eclipse.
the class ChannelEndpointImpl method startTiming.
void startTiming(String message) {
if (TRACE_TIME) {
startTime = System.currentTimeMillis();
StringBuffer buf = new StringBuffer("TIMING.START;");
buf.append(sdf.format(new Date(startTime))).append(";");
buf.append((message == null ? "" : message));
LogService logService = RemoteOSGiServiceImpl.log;
if (logService != null && USE_LOG_SERVICE)
logService.log(LogService.LOG_INFO, buf.toString());
else
System.out.println(buf.toString());
}
}
Aggregations