Search in sources :

Example 1 with MachineLogMessageImpl

use of org.eclipse.che.api.machine.server.model.impl.MachineLogMessageImpl 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));
    }
}
Also used : ConcurrentCompositeLineConsumer(org.eclipse.che.api.core.util.lineconsumer.ConcurrentCompositeLineConsumer) ConcurrentFileLineConsumer(org.eclipse.che.api.core.util.lineconsumer.ConcurrentFileLineConsumer) LineConsumer(org.eclipse.che.api.core.util.LineConsumer) AbstractLineConsumer(org.eclipse.che.api.core.util.AbstractLineConsumer) AbstractLineConsumer(org.eclipse.che.api.core.util.AbstractLineConsumer) ConcurrentFileLineConsumer(org.eclipse.che.api.core.util.lineconsumer.ConcurrentFileLineConsumer) ConcurrentCompositeLineConsumer(org.eclipse.che.api.core.util.lineconsumer.ConcurrentCompositeLineConsumer) MachineException(org.eclipse.che.api.machine.server.exception.MachineException) MachineLogMessageImpl(org.eclipse.che.api.machine.server.model.impl.MachineLogMessageImpl) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 AbstractLineConsumer (org.eclipse.che.api.core.util.AbstractLineConsumer)1 LineConsumer (org.eclipse.che.api.core.util.LineConsumer)1 ConcurrentCompositeLineConsumer (org.eclipse.che.api.core.util.lineconsumer.ConcurrentCompositeLineConsumer)1 ConcurrentFileLineConsumer (org.eclipse.che.api.core.util.lineconsumer.ConcurrentFileLineConsumer)1 MachineException (org.eclipse.che.api.machine.server.exception.MachineException)1 MachineLogMessageImpl (org.eclipse.che.api.machine.server.model.impl.MachineLogMessageImpl)1