Skip to content

Commit

Permalink
Suppressed exception logging in case of log file or path absence
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir committed Jan 16, 2017
1 parent e60023e commit 351bf23
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ choices:
- group: Логи в CP1251
# encoding: CP-1251
paths:
- log-samples/bankplus.log as "$g - $f"
- log-samples/bankplus.log as "$g - $f" (selected)

- group: Логи UPC-2
paths:
Expand All @@ -22,4 +22,4 @@ choices:
- group: JavaScript
scanDir: C:\lang\analog\src\main\resources\static\js
paths:
- C:\lang\analog\src\main\resources\static\js\main-controller.js as "Main.JS" (selected)
- C:\lang\analog\src\main\resources\static\js\main-controller.js as "Main.JS"
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import ru.ftc.upc.testing.analog.util.Util;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.concurrent.ConcurrentHashMap;

Expand Down Expand Up @@ -65,6 +66,9 @@ private void processPath(String path) {
"(took {} ms).", path, DEFAULT_ENCODING, (System.currentTimeMillis() - fileProcessingStart));
}

} catch (FileNotFoundException e) {
log.warn("Couldn't detect encoding of log '{}' because it wasn't found.", path);

} catch (IOException e) {
detectedEncodings.put(path, DEFAULT_ENCODING);
log.warn(format("Couldn't detect encoding of log '%s' because of error. %s has been selected as default",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
Expand Down Expand Up @@ -144,6 +145,9 @@ private Stream<LogChoice> flattenGroup(ChoiceGroup group) {
Util.expandTitle(logPath.toString(), DEFAULT_TITLE_FORMAT, groupName),
false))
.collect(toSet()));
} catch (NoSuchFileException e) {
log.warn("Path '{}' is not found and thus won't be scanned.", scanDirPath);

} catch (IOException e) {
log.error(format("Failed to scan directory '%s'; will be ignored.", group.getScanDir()), e);
}
Expand Down

0 comments on commit 351bf23

Please sign in to comment.