Skip to content

added log file overwrite option to HopRun #4365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion engine/src/main/java/org/apache/hop/run/HopRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ public class HopRun implements Runnable, IHasHopMetadataProvider {
description = "The complete filename where hop-run will write the Hop console log")
private String logFile;

@Option(
names = {"-lfo", "--logfile-overwrite"},
description = "Overwrite the log file if it exists")
private boolean logFileOverwrite;

@Option(
names = {"-p", "--parameters"},
description = "A list of PARAMETER=VALUE pairs")
Expand Down Expand Up @@ -195,7 +200,7 @@ public void run() {
}

if (!Utils.isEmpty(logFile)) {
fileLoggingEventListener = new FileLoggingEventListener(logFile, false);
fileLoggingEventListener = new FileLoggingEventListener(logFile, logFileOverwrite);
HopLogStore.getAppender().addLoggingEventListener(fileLoggingEventListener);
}

Expand Down Expand Up @@ -826,6 +831,14 @@ public void setLogFile(String logFile) {
this.logFile = logFile;
}

public boolean getLogFileOverwrite() {
return logFileOverwrite;
}

public void setLogFileOverwrite(boolean logFileOverwrite) {
this.logFileOverwrite = logFileOverwrite;
}

/**
* @param metadataProvider The metadataProvider to set
*/
Expand Down
Loading