Fix log compression
Any uncaught exception was silently causing subsequent executions to be suppressed. Catch and log any exceptions so root cause could be identified and subsequent execution are not suppressed. Change-Id: Ide998eb1edf583b483b3ce4f06c5b3a5dd1288d8
This commit is contained in:
parent
e9079fc72a
commit
9a28860560
@ -93,17 +93,21 @@ public class LogFileCompressor implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (!Files.isDirectory(logs_dir)) {
|
||||
return;
|
||||
}
|
||||
try (DirectoryStream<Path> list = Files.newDirectoryStream(logs_dir)) {
|
||||
for (Path entry : list) {
|
||||
if (!isLive(entry) && !isCompressed(entry) && isLogFile(entry)) {
|
||||
compress(entry);
|
||||
}
|
||||
try {
|
||||
if (!Files.isDirectory(logs_dir)) {
|
||||
return;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("Error listing logs to compress in " + logs_dir, e);
|
||||
try (DirectoryStream<Path> list = Files.newDirectoryStream(logs_dir)) {
|
||||
for (Path entry : list) {
|
||||
if (!isLive(entry) && !isCompressed(entry) && isLogFile(entry)) {
|
||||
compress(entry);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("Error listing logs to compress in " + logs_dir, e);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to compress log files: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user