Skip to content

Commit

Permalink
[improve][broker] Change log level to reduce duplicated logs (apache#…
Browse files Browse the repository at this point in the history
…22147)

(cherry picked from commit c36c18d)
(cherry picked from commit 6f43f3e)
  • Loading branch information
mattisonchao authored and mukesh-ctds committed Apr 15, 2024
1 parent f005d6f commit e350c0d
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,20 @@ private static boolean isPhysicalNic(Path nicPath) {
return false;
}
// Check the type to make sure it's ethernet (type "1")
String type = readTrimStringFromFile(nicPath.resolve("type"));
final Path nicTypePath = nicPath.resolve("type");
if (!Files.exists(nicTypePath)) {
if (log.isDebugEnabled()) {
log.debug("Failed to read NIC type, the expected linux type file does not exist."
+ " nic_type_path={}", nicTypePath);
}
return false;
}
// wireless NICs don't report speed, ignore them.
return Integer.parseInt(type) == ARPHRD_ETHER;
} catch (Exception e) {
log.warn("[LinuxInfo] Failed to read {} NIC type, the detail is: {}", nicPath, e.getMessage());
// Read type got error.
return Integer.parseInt(readTrimStringFromFile(nicTypePath)) == ARPHRD_ETHER;
} catch (Exception ex) {
if (log.isDebugEnabled()) {
log.debug("Failed to read NIC type. nic_path={}", nicPath, ex);
}
return false;
}
}
Expand Down

0 comments on commit e350c0d

Please sign in to comment.