Skip to content

Commit

Permalink
Merge pull request #233 from melissalinkert/fix-logging-config
Browse files Browse the repository at this point in the history
Move logging configuration to beginning of call() method
  • Loading branch information
chris-allan authored Jan 15, 2024
2 parents 3def4ea + 75cc25a commit 58f6e40
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ distributions {
}

startScripts {
defaultJvmOpts = ['--add-opens', 'java.base/java.lang=ALL-UNNAMED']

// placing logback.xml somewhere under src/dist/lib/ keeps it out of
// bioformats2raw-*.jar but automatically includes it in the distribution zip
// the directory containing logback.xml must be explicitly added to the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,10 @@ public DimensionOrder getDimensionOrder() {
*/
@Override
public Integer call() throws Exception {
ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger)
LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
root.setLevel(Level.toLevel(logLevel));

if (printVersion) {
String version = Optional.ofNullable(
this.getClass().getPackage().getImplementationVersion()
Expand Down Expand Up @@ -1118,10 +1122,6 @@ public Integer call() throws Exception {

OpenCVTools.loadOpenCV();

ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger)
LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
root.setLevel(Level.toLevel(logLevel));

if (progressBars) {
setProgressListener(new ProgressBarListener(logLevel));
}
Expand Down

0 comments on commit 58f6e40

Please sign in to comment.