Starting from 2021-07-01, all LRZ GitLab users will be required to explicitly accept the GitLab Terms of Service. Please see the detailed information at https://doku.lrz.de/display/PUBLIC/GitLab and make sure that your projects conform to the requirements.

Commit 0a5cdb64 authored by Stefan Schuhbaeck's avatar Stefan Schuhbaeck
Browse files

add log output to JoltMigrationAssistant

parent 085f8fb6
......@@ -41,6 +41,12 @@ public class IncidentMigrationAssistant extends MigrationAssistant {
return log.toString();
}
@Override
public void restLog() {
log.setLength(0);
}
// @Override
// public void analyzeSingleScenario(Path path) throws IOException {
// try {
......@@ -201,8 +207,4 @@ public class IncidentMigrationAssistant extends MigrationAssistant {
Files.move(source, target, StandardCopyOption.REPLACE_EXISTING); // ensure potential existing files aren't overwritten?
}
private String getTimestamp() {
return new SimpleDateFormat("yyyyMMddHHmmss").format(new java.util.Date());
}
}
......@@ -43,6 +43,11 @@ public class JoltMigrationAssistant extends MigrationAssistant {
return appender.getMigrationLog();
}
@Override
public void restLog() {
appender.rest();
}
@Override
public MigrationResult analyzeProject(String projectFolderPath) throws IOException {
......@@ -92,6 +97,12 @@ public class JoltMigrationAssistant extends MigrationAssistant {
stats.notmigratable++;
}
}
if (stats.legacy + stats.notmigratable > 0)
IOUtils.writeTextFile(legacyDir.resolve("_LOG-" + getTimestamp() + ".txt").toString(), getLog());
// clean appender for next run with same JoltMigrationAssistant instance
restLog();
return stats;
}
......
......@@ -2,6 +2,7 @@ package org.vadere.simulator.projects.migration;
import java.io.IOException;
import java.nio.file.Path;
import java.text.SimpleDateFormat;
public abstract class MigrationAssistant {
public static final String INCIDENT_ORDER_ERROR = "An incident that was found applicable couldn't be resolved. " +
......@@ -23,7 +24,13 @@ public abstract class MigrationAssistant {
public abstract String getLog();
public abstract void restLog();
// public abstract void analyzeSingleScenario(Path path) throws IOException;
public abstract MigrationResult analyzeProject(String projectFolderPath) throws IOException;
protected String getTimestamp() {
return new SimpleDateFormat("yyyyMMddHHmmss").format(new java.util.Date());
}
}
......@@ -28,6 +28,11 @@ public class LogBufferAppender extends AppenderSkeleton {
return sb.toString();
}
public void rest(){
sb.setLength(0);
}
@Override
protected void append(LoggingEvent loggingEvent) {
sb.append(layout.format(loggingEvent));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment