use of org.platformlayer.jobs.model.JobLogLine in project platformlayer by platformlayer.
the class SimpleJobLogger method enterScope.
@Override
public void enterScope(Object controller) {
String name = ControllerNameStrategy.getName(controller);
JobLogLine line = new JobLogLine();
line.type = JobLogLine.TYPE_ENTER_SCOPE;
line.message = name;
lines.add(line);
}
use of org.platformlayer.jobs.model.JobLogLine in project platformlayer by platformlayer.
the class SimpleJobLogger method toString.
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
for (JobLogLine jobLogLine : this.getLogEntries()) {
sb.append(jobLogLine.getMessage());
JobLogExceptionInfo exception = jobLogLine.getException();
if (exception != null) {
List<String> infos = exception.getInfo();
for (int i = 0; i < infos.size(); i++) {
String infoLine = infos.get(i);
if (i != 0) {
sb.append('\n');
}
sb.append(infoLine);
}
}
sb.append("\n");
}
return sb.toString();
}
use of org.platformlayer.jobs.model.JobLogLine in project platformlayer by platformlayer.
the class SimpleJobLogger method logMessage.
@Override
public void logMessage(String message, List<String[]> exceptionStacks, int level) {
JobLogExceptionInfo jobLogExceptionInfo = null;
if (exceptionStacks != null) {
jobLogExceptionInfo = JobUtils.buildJobLogExceptionInfo(exceptionStacks);
}
JobLogLine jobLogLine = new JobLogLine(System.currentTimeMillis(), level, message, jobLogExceptionInfo);
lines.add(jobLogLine);
}
use of org.platformlayer.jobs.model.JobLogLine in project platformlayer by platformlayer.
the class JobLogStoreBase method deserialize.
protected JobLog deserialize(InputSupplier<? extends InputStream> iss, int logSkip) throws IOException {
ArrayList<JobLogLine> lines = Lists.newArrayList();
InputStream is = null;
CodedInputStream in = null;
try {
is = iss.getInput();
is = new GZIPInputStream(is);
in = CodedInputStream.newInstance(is);
int i = 0;
JobDataProtobuf.JobLogLine.Builder protobuf = JobDataProtobuf.JobLogLine.newBuilder();
while (!in.isAtEnd()) {
int length = in.readRawVarint32();
if (i < logSkip) {
in.skipRawBytes(length);
} else {
int oldLimit = in.pushLimit(length);
protobuf.clear();
protobuf.mergeFrom(in);
JobLogLine line = new JobLogLine();
line.level = protobuf.getLevel();
line.timestamp = protobuf.getTimestamp();
line.message = protobuf.getMessage();
line.type = protobuf.getType();
if (protobuf.hasException()) {
line.exception = mapFromProtobuf(protobuf.getExceptionBuilder());
}
lines.add(line);
in.popLimit(oldLimit);
}
i++;
}
} finally {
// Closeables.closeQuietly(in);
Closeables.closeQuietly(is);
}
JobLog jobLog = new JobLog();
jobLog.lines = lines;
return jobLog;
}
Aggregations