use of org.eclipse.che.api.core.util.lineconsumer.ConcurrentCompositeLineConsumer in project che by eclipse.
the class CheEnvironmentEngine method getMachineLogger.
private LineConsumer getMachineLogger(MessageConsumer<MachineLogMessage> environmentLogger, String machineId, String machineName) throws ServerException {
createMachineLogsDir(machineId);
LineConsumer lineConsumer = new AbstractLineConsumer() {
@Override
public void writeLine(String line) throws IOException {
environmentLogger.consume(new MachineLogMessageImpl(machineName, line));
}
};
try {
return new ConcurrentCompositeLineConsumer(new ConcurrentFileLineConsumer(getMachineLogsFile(machineId)), lineConsumer);
} catch (IOException e) {
throw new MachineException(format("Unable create log file '%s' for machine '%s'.", e.getLocalizedMessage(), machineId));
}
}
Aggregations