ServiceReference readerRef = context.getServiceReference(ExtendedLogReaderService.class.getName());
ServiceReference packageAdminRef = context.getServiceReference(PackageAdmin.class.getName());
if (logRef == null || readerRef == null || packageAdminRef == null)
return null;
ExtendedLogService logService = (ExtendedLogService) context.getService(logRef);
ExtendedLogReaderService readerService = (ExtendedLogReaderService) context.getService(readerRef);
PackageAdmin packageAdmin = (PackageAdmin) context.getService(packageAdminRef);
if (logService == null || readerService == null || packageAdmin == null)
return null;
PlatformLogWriter writer = new PlatformLogWriter(logService, packageAdmin, context.getBundle());
readerService.addLogListener(writer, writer);
return writer;
}