The fact that there can be multiple registered services of a particular type can sometimes be problematic. Consider the
LogService and it's cousin the
LogReaderService. When there are multiple registered
LogService and
LogReaderService pairs it can be tricky for an application to be able to present a single view of the application's logged messages.
It is this reason that SAT now has a
LogReaderAggregatorService. As its name implies, it aggregates each registered
LogReaderService and presents a single service API with which to work with the application's entire log. The
LogReaderAggregatorService is straight forward:
public interface LogReaderAggregatorService extends LogReaderService {
public Enumeration/*<LogEntry>*/ getLogInOrder();
public boolean isLoggingToConsole();
public void setLogToConsole(boolean logToConsole);
} Since the interface extends the OSGi-defined
LogReaderService you can use the API you're familiar with, such as
getLog(), but of course what you'll get back is an
Enumeration of every
LogEvent for every registered
LogReaderService, in reverse chronological order.
The
LogReaderAggregatorService interfaces adds the method
getLogInOrder() for accessing every logged message in chronological order, and a couple of methods for controlling whether logged messages will be echoed to the console.
While the
LogReaderAggregatorService interface is part of the required bundle
org.eclipse.soda.sat.core, the implementation lives in the optional bundle
org.eclipse.soda.sat.core.log.