Make native loading logging less confusing (#10944)

Motivation:

We produced a lot of noise during loading native libraries as we always included the stacktrace if we could not load by one mechanism. We should better just not include the stacktrace in the debugging logging if one mechanism fails. We will log all the stacks anyway when all of the mechanisms fail.

Modifications:

Make logging less aggressive

Result:

Less confusing behaviour for the end-user
This commit is contained in:
Norman Maurer 2021-01-16 09:56:44 +01:00 committed by GitHub
parent 94646ac546
commit 4d43f16bb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -97,9 +97,9 @@ public final class NativeLibraryLoader {
return;
} catch (Throwable t) {
suppressed.add(t);
logger.debug("Unable to load the library '{}', trying next name...", name, t);
}
}
IllegalArgumentException iae =
new IllegalArgumentException("Failed to load any of the given libraries: " + Arrays.toString(names));
ThrowableUtil.addSuppressedAndClear(iae, suppressed);
@ -137,11 +137,6 @@ public final class NativeLibraryLoader {
return;
} catch (Throwable ex) {
suppressed.add(ex);
if (logger.isDebugEnabled()) {
logger.debug(
"{} cannot be loaded from java.library.path, "
+ "now trying export to -Dio.netty.native.workdir: {}", name, WORKDIR, ex);
}
}
String libname = System.mapLibraryName(name);
@ -343,10 +338,8 @@ public final class NativeLibraryLoader {
return;
} catch (UnsatisfiedLinkError e) { // Should by pass the UnsatisfiedLinkError here!
suppressed = e;
logger.debug("Unable to load the library '{}', trying other loading mechanism.", name, e);
} catch (Exception e) {
suppressed = e;
logger.debug("Unable to load the library '{}', trying other loading mechanism.", name, e);
}
NativeLibraryUtil.loadLibrary(name, absolute); // Fallback to local helper class.
logger.debug("Successfully loaded the library {}", name);