You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by GitBox <gi...@apache.org> on 2021/08/22 16:46:33 UTC

[GitHub] [logging-log4j2] asapha commented on a change in pull request #565: LOG4J2-2808 LoggerContext should skip looking up localhost when hostName is configured

asapha commented on a change in pull request #565:
URL: https://github.com/apache/logging-log4j2/pull/565#discussion_r693527832



##########
File path: log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java
##########
@@ -609,7 +610,13 @@ public Configuration setConfiguration(final Configuration config) {
             final ConcurrentMap<String, String> map = config.getComponent(Configuration.CONTEXT_PROPERTIES);
 
             try { // LOG4J2-719 network access may throw android.os.NetworkOnMainThreadException
-                map.putIfAbsent("hostName", NetUtils.getLocalHostname());
+                // LOG4J2-2808 don't block unless necessary
+                map.computeIfAbsent("hostName", new Function<String, String>() {

Review comment:
       Fixed. 👍




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org