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 15:56:06 UTC

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

asapha opened a new pull request #565:
URL: https://github.com/apache/logging-log4j2/pull/565


   https://issues.apache.org/jira/browse/LOG4J2-2808


-- 
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



[GitHub] [logging-log4j2] carterkozak closed pull request #565: LOG4J2-2808 LoggerContext should skip looking up localhost when hostName is configured

Posted by GitBox <gi...@apache.org>.
carterkozak closed pull request #565:
URL: https://github.com/apache/logging-log4j2/pull/565


   


-- 
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



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

Posted by GitBox <gi...@apache.org>.
garydgregory commented on a change in pull request #565:
URL: https://github.com/apache/logging-log4j2/pull/565#discussion_r693526761



##########
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:
       You don't have to be so verbose here, use () -> or ::




-- 
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



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

Posted by GitBox <gi...@apache.org>.
carterkozak commented on pull request #565:
URL: https://github.com/apache/logging-log4j2/pull/565#issuecomment-907946139


   I've applied the fix as 177a85708535cad6a3e0af9468f323135cc91fbd, thanks for the contribution!


-- 
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



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

Posted by GitBox <gi...@apache.org>.
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