[jira] [Commented] (HADOOP-18653) LogLevel servlet to determine log impl before using setLevel

2023-03-13 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/HADOOP-18653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17699606#comment-17699606
 ] 

ASF GitHub Bot commented on HADOOP-18653:
-

steveloughran merged PR #5456:
URL: https://github.com/apache/hadoop/pull/5456




> LogLevel servlet to determine log impl before using setLevel
> 
>
> Key: HADOOP-18653
> URL: https://issues.apache.org/jira/browse/HADOOP-18653
> Project: Hadoop Common
>  Issue Type: Sub-task
>Reporter: Viraj Jasani
>Assignee: Viraj Jasani
>Priority: Major
>  Labels: pull-request-available
>
> LogLevel GET API is used to set log level for a given class name dynamically. 
> While we have cleaned up the commons-logging references, it would be great to 
> determine whether slf4j log4j adapter is in the classpath before allowing 
> client to set the log level.
> Proposed changes:
>  * Use slf4j logger factory to get the log reference for the given class name
>  * Use generic utility to identify if the slf4j log4j adapter is in the 
> classpath before using log4j API to update the log level
>  * If the log4j adapter is not in the classpath, report error in the output



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[jira] [Commented] (HADOOP-18653) LogLevel servlet to determine log impl before using setLevel

2023-03-10 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/HADOOP-18653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17699141#comment-17699141
 ] 

ASF GitHub Bot commented on HADOOP-18653:
-

hadoop-yetus commented on PR #5456:
URL: https://github.com/apache/hadoop/pull/5456#issuecomment-1464719876

   :confetti_ball: **+1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime |  Logfile | Comment |
   |::|--:|:|::|:---:|
   | +0 :ok: |  reexec  |   0m 52s |  |  Docker mode activated.  |
    _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  0s |  |  No case conflicting files 
found.  |
   | +0 :ok: |  codespell  |   0m  1s |  |  codespell was not available.  |
   | +0 :ok: |  detsecrets  |   0m  1s |  |  detect-secrets was not available.  
|
   | +1 :green_heart: |  @author  |   0m  0s |  |  The patch does not contain 
any @author tags.  |
   | +1 :green_heart: |  test4tests  |   0m  0s |  |  The patch appears to 
include 1 new or modified test files.  |
    _ trunk Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |  38m 32s |  |  trunk passed  |
   | +1 :green_heart: |  compile  |  23m 17s |  |  trunk passed with JDK 
Ubuntu-11.0.18+10-post-Ubuntu-0ubuntu120.04.1  |
   | +1 :green_heart: |  compile  |  20m 38s |  |  trunk passed with JDK 
Private Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09  |
   | +1 :green_heart: |  checkstyle  |   1m 16s |  |  trunk passed  |
   | +1 :green_heart: |  mvnsite  |   1m 48s |  |  trunk passed  |
   | +1 :green_heart: |  javadoc  |   1m 14s |  |  trunk passed with JDK 
Ubuntu-11.0.18+10-post-Ubuntu-0ubuntu120.04.1  |
   | +1 :green_heart: |  javadoc  |   0m 51s |  |  trunk passed with JDK 
Private Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09  |
   | +1 :green_heart: |  spotbugs  |   2m 48s |  |  trunk passed  |
   | +1 :green_heart: |  shadedclient  |  22m 42s |  |  branch has no errors 
when building and testing our client artifacts.  |
    _ Patch Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   1m  1s |  |  the patch passed  |
   | +1 :green_heart: |  compile  |  22m 34s |  |  the patch passed with JDK 
Ubuntu-11.0.18+10-post-Ubuntu-0ubuntu120.04.1  |
   | +1 :green_heart: |  javac  |  22m 34s |  |  the patch passed  |
   | +1 :green_heart: |  compile  |  20m 38s |  |  the patch passed with JDK 
Private Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09  |
   | +1 :green_heart: |  javac  |  20m 38s |  |  the patch passed  |
   | +1 :green_heart: |  blanks  |   0m  0s |  |  The patch has no blanks 
issues.  |
   | +1 :green_heart: |  checkstyle  |   1m  6s |  |  the patch passed  |
   | +1 :green_heart: |  mvnsite  |   1m 43s |  |  the patch passed  |
   | +1 :green_heart: |  javadoc  |   1m  7s |  |  the patch passed with JDK 
Ubuntu-11.0.18+10-post-Ubuntu-0ubuntu120.04.1  |
   | +1 :green_heart: |  javadoc  |   0m 52s |  |  the patch passed with JDK 
Private Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09  |
   | +1 :green_heart: |  spotbugs  |   2m 41s |  |  the patch passed  |
   | +1 :green_heart: |  shadedclient  |  22m 20s |  |  patch has no errors 
when building and testing our client artifacts.  |
    _ Other Tests _ |
   | +1 :green_heart: |  unit  |  18m 27s |  |  hadoop-common in the patch 
passed.  |
   | +1 :green_heart: |  asflicense  |   1m  3s |  |  The patch does not 
generate ASF License warnings.  |
   |  |   | 208m 14s |  |  |
   
   
   | Subsystem | Report/Notes |
   |--:|:-|
   | Docker | ClientAPI=1.42 ServerAPI=1.42 base: 
https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-5456/4/artifact/out/Dockerfile
 |
   | GITHUB PR | https://github.com/apache/hadoop/pull/5456 |
   | Optional Tests | dupname asflicense compile javac javadoc mvninstall 
mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets |
   | uname | Linux aa35c8c218a4 4.15.0-200-generic #211-Ubuntu SMP Thu Nov 24 
18:16:04 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev-support/bin/hadoop.sh |
   | git revision | trunk / cfd3e93c6255f04131ffe135134537709d9a144b |
   | Default Java | Private Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09 |
   | Multi-JDK versions | 
/usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.18+10-post-Ubuntu-0ubuntu120.04.1
 /usr/lib/jvm/java-8-openjdk-amd64:Private 
Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09 |
   |  Test Results | 
https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-5456/4/testReport/ |
   | Max. process+thread count | 1500 (vs. ulimit of 5500) |
   | modules | C: hadoop-common-project/hadoop-common U: 
hadoop-common-project/hadoop-common |
   | Console output | 
https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-5456/4/console |
   | versions | git=2.25.1 maven=3.6.3 spotbugs=4.2.2 |
   | Powered by | Apache Yetus 0.14.0 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   




> 

[jira] [Commented] (HADOOP-18653) LogLevel servlet to determine log impl before using setLevel

2023-03-10 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/HADOOP-18653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17699119#comment-17699119
 ] 

ASF GitHub Bot commented on HADOOP-18653:
-

hadoop-yetus commented on PR #5456:
URL: https://github.com/apache/hadoop/pull/5456#issuecomment-1464500913

   :confetti_ball: **+1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime |  Logfile | Comment |
   |::|--:|:|::|:---:|
   | +0 :ok: |  reexec  |   0m 38s |  |  Docker mode activated.  |
    _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  0s |  |  No case conflicting files 
found.  |
   | +0 :ok: |  codespell  |   0m  0s |  |  codespell was not available.  |
   | +0 :ok: |  detsecrets  |   0m  0s |  |  detect-secrets was not available.  
|
   | +1 :green_heart: |  @author  |   0m  0s |  |  The patch does not contain 
any @author tags.  |
   | +1 :green_heart: |  test4tests  |   0m  0s |  |  The patch appears to 
include 1 new or modified test files.  |
    _ trunk Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |  38m 43s |  |  trunk passed  |
   | +1 :green_heart: |  compile  |  23m 11s |  |  trunk passed with JDK 
Ubuntu-11.0.18+10-post-Ubuntu-0ubuntu120.04.1  |
   | +1 :green_heart: |  compile  |  20m 38s |  |  trunk passed with JDK 
Private Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09  |
   | +1 :green_heart: |  checkstyle  |   1m 14s |  |  trunk passed  |
   | +1 :green_heart: |  mvnsite  |   1m 43s |  |  trunk passed  |
   | +1 :green_heart: |  javadoc  |   1m 17s |  |  trunk passed with JDK 
Ubuntu-11.0.18+10-post-Ubuntu-0ubuntu120.04.1  |
   | +1 :green_heart: |  javadoc  |   0m 51s |  |  trunk passed with JDK 
Private Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09  |
   | +1 :green_heart: |  spotbugs  |   2m 51s |  |  trunk passed  |
   | +1 :green_heart: |  shadedclient  |  22m 36s |  |  branch has no errors 
when building and testing our client artifacts.  |
    _ Patch Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   1m  0s |  |  the patch passed  |
   | +1 :green_heart: |  compile  |  22m 34s |  |  the patch passed with JDK 
Ubuntu-11.0.18+10-post-Ubuntu-0ubuntu120.04.1  |
   | +1 :green_heart: |  javac  |  22m 34s |  |  the patch passed  |
   | +1 :green_heart: |  compile  |  20m 36s |  |  the patch passed with JDK 
Private Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09  |
   | +1 :green_heart: |  javac  |  20m 36s |  |  the patch passed  |
   | +1 :green_heart: |  blanks  |   0m  0s |  |  The patch has no blanks 
issues.  |
   | +1 :green_heart: |  checkstyle  |   1m  6s |  |  the patch passed  |
   | +1 :green_heart: |  mvnsite  |   1m 43s |  |  the patch passed  |
   | +1 :green_heart: |  javadoc  |   1m  5s |  |  the patch passed with JDK 
Ubuntu-11.0.18+10-post-Ubuntu-0ubuntu120.04.1  |
   | +1 :green_heart: |  javadoc  |   0m 51s |  |  the patch passed with JDK 
Private Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09  |
   | +1 :green_heart: |  spotbugs  |   2m 42s |  |  the patch passed  |
   | +1 :green_heart: |  shadedclient  |  22m 16s |  |  patch has no errors 
when building and testing our client artifacts.  |
    _ Other Tests _ |
   | +1 :green_heart: |  unit  |  18m 19s |  |  hadoop-common in the patch 
passed.  |
   | +1 :green_heart: |  asflicense  |   1m  2s |  |  The patch does not 
generate ASF License warnings.  |
   |  |   | 207m 28s |  |  |
   
   
   | Subsystem | Report/Notes |
   |--:|:-|
   | Docker | ClientAPI=1.42 ServerAPI=1.42 base: 
https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-5456/3/artifact/out/Dockerfile
 |
   | GITHUB PR | https://github.com/apache/hadoop/pull/5456 |
   | Optional Tests | dupname asflicense compile javac javadoc mvninstall 
mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets |
   | uname | Linux dd115a00a37e 4.15.0-200-generic #211-Ubuntu SMP Thu Nov 24 
18:16:04 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev-support/bin/hadoop.sh |
   | git revision | trunk / c74b7a059a528369ba49ad279880a523d84d75cb |
   | Default Java | Private Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09 |
   | Multi-JDK versions | 
/usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.18+10-post-Ubuntu-0ubuntu120.04.1
 /usr/lib/jvm/java-8-openjdk-amd64:Private 
Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09 |
   |  Test Results | 
https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-5456/3/testReport/ |
   | Max. process+thread count | 1520 (vs. ulimit of 5500) |
   | modules | C: hadoop-common-project/hadoop-common U: 
hadoop-common-project/hadoop-common |
   | Console output | 
https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-5456/3/console |
   | versions | git=2.25.1 maven=3.6.3 spotbugs=4.2.2 |
   | Powered by | Apache Yetus 0.14.0 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   




> 

[jira] [Commented] (HADOOP-18653) LogLevel servlet to determine log impl before using setLevel

2023-03-10 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/HADOOP-18653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17699115#comment-17699115
 ] 

ASF GitHub Bot commented on HADOOP-18653:
-

virajjasani commented on code in PR #5456:
URL: https://github.com/apache/hadoop/pull/5456#discussion_r1132889680


##
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/GenericsUtil.java:
##
@@ -103,14 +113,15 @@ public static boolean isLog4jLogger(Class clazz) {
* @return true if the logger uses Log4J implementation.
*/
   public static boolean isLog4jLogger(String logger) {
-if (logger == null) {
+if (logger == null || !IS_LOG4J_LOGGER.get()) {
   return false;
 }
 Logger log = LoggerFactory.getLogger(logger);
 try {

Review Comment:
   Refactored to keep the logic in only one utility method. The other method 
will just call this one. Simplified (exactly as slf4j library methods).





> LogLevel servlet to determine log impl before using setLevel
> 
>
> Key: HADOOP-18653
> URL: https://issues.apache.org/jira/browse/HADOOP-18653
> Project: Hadoop Common
>  Issue Type: Sub-task
>Reporter: Viraj Jasani
>Assignee: Viraj Jasani
>Priority: Major
>  Labels: pull-request-available
>
> LogLevel GET API is used to set log level for a given class name dynamically. 
> While we have cleaned up the commons-logging references, it would be great to 
> determine whether slf4j log4j adapter is in the classpath before allowing 
> client to set the log level.
> Proposed changes:
>  * Use slf4j logger factory to get the log reference for the given class name
>  * Use generic utility to identify if the slf4j log4j adapter is in the 
> classpath before using log4j API to update the log level
>  * If the log4j adapter is not in the classpath, report error in the output



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[jira] [Commented] (HADOOP-18653) LogLevel servlet to determine log impl before using setLevel

2023-03-10 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/HADOOP-18653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17699113#comment-17699113
 ] 

ASF GitHub Bot commented on HADOOP-18653:
-

virajjasani commented on code in PR #5456:
URL: https://github.com/apache/hadoop/pull/5456#discussion_r1132705151


##
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/GenericsUtil.java:
##
@@ -103,14 +113,15 @@ public static boolean isLog4jLogger(Class clazz) {
* @return true if the logger uses Log4J implementation.
*/
   public static boolean isLog4jLogger(String logger) {
-if (logger == null) {
+if (logger == null || !IS_LOG4J_LOGGER.get()) {
   return false;
 }
 Logger log = LoggerFactory.getLogger(logger);
 try {

Review Comment:
   How about this latest commit? 
https://github.com/apache/hadoop/pull/5456/commits/c74b7a059a528369ba49ad279880a523d84d75cb
 and 
https://github.com/apache/hadoop/pull/5456/commits/cfd3e93c6255f04131ffe135134537709d9a144b





> LogLevel servlet to determine log impl before using setLevel
> 
>
> Key: HADOOP-18653
> URL: https://issues.apache.org/jira/browse/HADOOP-18653
> Project: Hadoop Common
>  Issue Type: Sub-task
>Reporter: Viraj Jasani
>Assignee: Viraj Jasani
>Priority: Major
>  Labels: pull-request-available
>
> LogLevel GET API is used to set log level for a given class name dynamically. 
> While we have cleaned up the commons-logging references, it would be great to 
> determine whether slf4j log4j adapter is in the classpath before allowing 
> client to set the log level.
> Proposed changes:
>  * Use slf4j logger factory to get the log reference for the given class name
>  * Use generic utility to identify if the slf4j log4j adapter is in the 
> classpath before using log4j API to update the log level
>  * If the log4j adapter is not in the classpath, report error in the output



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[jira] [Commented] (HADOOP-18653) LogLevel servlet to determine log impl before using setLevel

2023-03-10 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/HADOOP-18653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17699070#comment-17699070
 ] 

ASF GitHub Bot commented on HADOOP-18653:
-

virajjasani commented on code in PR #5456:
URL: https://github.com/apache/hadoop/pull/5456#discussion_r1132705151


##
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/GenericsUtil.java:
##
@@ -103,14 +113,15 @@ public static boolean isLog4jLogger(Class clazz) {
* @return true if the logger uses Log4J implementation.
*/
   public static boolean isLog4jLogger(String logger) {
-if (logger == null) {
+if (logger == null || !IS_LOG4J_LOGGER.get()) {
   return false;
 }
 Logger log = LoggerFactory.getLogger(logger);
 try {

Review Comment:
   How about this latest commit? 
https://github.com/apache/hadoop/pull/5456/commits/c74b7a059a528369ba49ad279880a523d84d75cb





> LogLevel servlet to determine log impl before using setLevel
> 
>
> Key: HADOOP-18653
> URL: https://issues.apache.org/jira/browse/HADOOP-18653
> Project: Hadoop Common
>  Issue Type: Sub-task
>Reporter: Viraj Jasani
>Assignee: Viraj Jasani
>Priority: Major
>  Labels: pull-request-available
>
> LogLevel GET API is used to set log level for a given class name dynamically. 
> While we have cleaned up the commons-logging references, it would be great to 
> determine whether slf4j log4j adapter is in the classpath before allowing 
> client to set the log level.
> Proposed changes:
>  * Use slf4j logger factory to get the log reference for the given class name
>  * Use generic utility to identify if the slf4j log4j adapter is in the 
> classpath before using log4j API to update the log level
>  * If the log4j adapter is not in the classpath, report error in the output



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[jira] [Commented] (HADOOP-18653) LogLevel servlet to determine log impl before using setLevel

2023-03-10 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/HADOOP-18653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17699068#comment-17699068
 ] 

ASF GitHub Bot commented on HADOOP-18653:
-

virajjasani commented on code in PR #5456:
URL: https://github.com/apache/hadoop/pull/5456#discussion_r1132698272


##
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/GenericsUtil.java:
##
@@ -103,14 +113,15 @@ public static boolean isLog4jLogger(Class clazz) {
* @return true if the logger uses Log4J implementation.
*/
   public static boolean isLog4jLogger(String logger) {
-if (logger == null) {
+if (logger == null || !IS_LOG4J_LOGGER.get()) {
   return false;
 }
 Logger log = LoggerFactory.getLogger(logger);
 try {

Review Comment:
   I think the other way around would be more appropriate?
   For instance, in slf4j implementation, they have:
   ```
   public static Logger getLogger(Class clazz) {
   Logger logger = getLogger(clazz.getName());
   ...
   ...
   ```
   
   Hence, we can also call clazz.getName() here.





> LogLevel servlet to determine log impl before using setLevel
> 
>
> Key: HADOOP-18653
> URL: https://issues.apache.org/jira/browse/HADOOP-18653
> Project: Hadoop Common
>  Issue Type: Sub-task
>Reporter: Viraj Jasani
>Assignee: Viraj Jasani
>Priority: Major
>  Labels: pull-request-available
>
> LogLevel GET API is used to set log level for a given class name dynamically. 
> While we have cleaned up the commons-logging references, it would be great to 
> determine whether slf4j log4j adapter is in the classpath before allowing 
> client to set the log level.
> Proposed changes:
>  * Use slf4j logger factory to get the log reference for the given class name
>  * Use generic utility to identify if the slf4j log4j adapter is in the 
> classpath before using log4j API to update the log level
>  * If the log4j adapter is not in the classpath, report error in the output



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[jira] [Commented] (HADOOP-18653) LogLevel servlet to determine log impl before using setLevel

2023-03-10 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/HADOOP-18653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17698986#comment-17698986
 ] 

ASF GitHub Bot commented on HADOOP-18653:
-

steveloughran commented on code in PR #5456:
URL: https://github.com/apache/hadoop/pull/5456#discussion_r1132513808


##
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/GenericsUtil.java:
##
@@ -103,14 +113,15 @@ public static boolean isLog4jLogger(Class clazz) {
* @return true if the logger uses Log4J implementation.
*/
   public static boolean isLog4jLogger(String logger) {
-if (logger == null) {
+if (logger == null || !IS_LOG4J_LOGGER.get()) {
   return false;
 }
 Logger log = LoggerFactory.getLogger(logger);
 try {

Review Comment:
   this try/catch is a duplicate of isLog4jLogger(class). 
   why not do `isLog4jLogger(LoggerFactory.getLogger(logger))`





> LogLevel servlet to determine log impl before using setLevel
> 
>
> Key: HADOOP-18653
> URL: https://issues.apache.org/jira/browse/HADOOP-18653
> Project: Hadoop Common
>  Issue Type: Sub-task
>Reporter: Viraj Jasani
>Assignee: Viraj Jasani
>Priority: Major
>  Labels: pull-request-available
>
> LogLevel GET API is used to set log level for a given class name dynamically. 
> While we have cleaned up the commons-logging references, it would be great to 
> determine whether slf4j log4j adapter is in the classpath before allowing 
> client to set the log level.
> Proposed changes:
>  * Use slf4j logger factory to get the log reference for the given class name
>  * Use generic utility to identify if the slf4j log4j adapter is in the 
> classpath before using log4j API to update the log level
>  * If the log4j adapter is not in the classpath, report error in the output



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[jira] [Commented] (HADOOP-18653) LogLevel servlet to determine log impl before using setLevel

2023-03-08 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/HADOOP-18653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17698135#comment-17698135
 ] 

ASF GitHub Bot commented on HADOOP-18653:
-

hadoop-yetus commented on PR #5456:
URL: https://github.com/apache/hadoop/pull/5456#issuecomment-1461128752

   :confetti_ball: **+1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime |  Logfile | Comment |
   |::|--:|:|::|:---:|
   | +0 :ok: |  reexec  |   0m 42s |  |  Docker mode activated.  |
    _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  0s |  |  No case conflicting files 
found.  |
   | +0 :ok: |  codespell  |   0m  1s |  |  codespell was not available.  |
   | +0 :ok: |  detsecrets  |   0m  1s |  |  detect-secrets was not available.  
|
   | +1 :green_heart: |  @author  |   0m  0s |  |  The patch does not contain 
any @author tags.  |
   | +1 :green_heart: |  test4tests  |   0m  0s |  |  The patch appears to 
include 1 new or modified test files.  |
    _ trunk Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |  39m  3s |  |  trunk passed  |
   | +1 :green_heart: |  compile  |  23m  7s |  |  trunk passed with JDK 
Ubuntu-11.0.18+10-post-Ubuntu-0ubuntu120.04.1  |
   | +1 :green_heart: |  compile  |  20m 24s |  |  trunk passed with JDK 
Private Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09  |
   | +1 :green_heart: |  checkstyle  |   1m 11s |  |  trunk passed  |
   | +1 :green_heart: |  mvnsite  |   1m 46s |  |  trunk passed  |
   | +1 :green_heart: |  javadoc  |   1m 17s |  |  trunk passed with JDK 
Ubuntu-11.0.18+10-post-Ubuntu-0ubuntu120.04.1  |
   | +1 :green_heart: |  javadoc  |   0m 52s |  |  trunk passed with JDK 
Private Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09  |
   | +1 :green_heart: |  spotbugs  |   2m 44s |  |  trunk passed  |
   | +1 :green_heart: |  shadedclient  |  22m 28s |  |  branch has no errors 
when building and testing our client artifacts.  |
    _ Patch Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   1m  1s |  |  the patch passed  |
   | +1 :green_heart: |  compile  |  22m 25s |  |  the patch passed with JDK 
Ubuntu-11.0.18+10-post-Ubuntu-0ubuntu120.04.1  |
   | +1 :green_heart: |  javac  |  22m 25s |  |  the patch passed  |
   | +1 :green_heart: |  compile  |  20m 33s |  |  the patch passed with JDK 
Private Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09  |
   | +1 :green_heart: |  javac  |  20m 33s |  |  the patch passed  |
   | +1 :green_heart: |  blanks  |   0m  0s |  |  The patch has no blanks 
issues.  |
   | +1 :green_heart: |  checkstyle  |   1m  9s |  |  the patch passed  |
   | +1 :green_heart: |  mvnsite  |   1m 40s |  |  the patch passed  |
   | +1 :green_heart: |  javadoc  |   1m  5s |  |  the patch passed with JDK 
Ubuntu-11.0.18+10-post-Ubuntu-0ubuntu120.04.1  |
   | +1 :green_heart: |  javadoc  |   0m 52s |  |  the patch passed with JDK 
Private Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09  |
   | +1 :green_heart: |  spotbugs  |   2m 43s |  |  the patch passed  |
   | +1 :green_heart: |  shadedclient  |  22m 26s |  |  patch has no errors 
when building and testing our client artifacts.  |
    _ Other Tests _ |
   | +1 :green_heart: |  unit  |  18m 19s |  |  hadoop-common in the patch 
passed.  |
   | +1 :green_heart: |  asflicense  |   1m  3s |  |  The patch does not 
generate ASF License warnings.  |
   |  |   | 207m 32s |  |  |
   
   
   | Subsystem | Report/Notes |
   |--:|:-|
   | Docker | ClientAPI=1.42 ServerAPI=1.42 base: 
https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-5456/2/artifact/out/Dockerfile
 |
   | GITHUB PR | https://github.com/apache/hadoop/pull/5456 |
   | Optional Tests | dupname asflicense compile javac javadoc mvninstall 
mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets |
   | uname | Linux 80c4ea3fdcc6 4.15.0-200-generic #211-Ubuntu SMP Thu Nov 24 
18:16:04 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev-support/bin/hadoop.sh |
   | git revision | trunk / 5ff719cbc28ba6a2bce291f50359fbcc1941e046 |
   | Default Java | Private Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09 |
   | Multi-JDK versions | 
/usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.18+10-post-Ubuntu-0ubuntu120.04.1
 /usr/lib/jvm/java-8-openjdk-amd64:Private 
Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09 |
   |  Test Results | 
https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-5456/2/testReport/ |
   | Max. process+thread count | 1549 (vs. ulimit of 5500) |
   | modules | C: hadoop-common-project/hadoop-common U: 
hadoop-common-project/hadoop-common |
   | Console output | 
https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-5456/2/console |
   | versions | git=2.25.1 maven=3.6.3 spotbugs=4.2.2 |
   | Powered by | Apache Yetus 0.14.0 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   




> 

[jira] [Commented] (HADOOP-18653) LogLevel servlet to determine log impl before using setLevel

2023-03-08 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/HADOOP-18653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17697972#comment-17697972
 ] 

ASF GitHub Bot commented on HADOOP-18653:
-

steveloughran commented on code in PR #5456:
URL: https://github.com/apache/hadoop/pull/5456#discussion_r1129648239


##
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/log/LogLevel.java:
##
@@ -338,14 +341,18 @@ public void doGet(HttpServletRequest request, 
HttpServletResponse response
 out.println(MARKER
 + "Submitted Class Name: " + logName + "");
 
-Logger log = Logger.getLogger(logName);
+org.slf4j.Logger log = LoggerFactory.getLogger(logName);
 out.println(MARKER
 + "Log Class: " + log.getClass().getName() +"");
 if (level != null) {
   out.println(MARKER + "Submitted Level: " + level + "");
 }
 
-process(log, level, out);
+if (GenericsUtil.isLog4jLogger(logName)) {
+  process(Logger.getLogger(logName), level, out);
+} else {
+  out.println("Sorry, " + log.getClass() + " not supported.");

Review Comment:
   text to explain "log4j loggers only"



##
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/GenericsUtil.java:
##
@@ -89,10 +89,30 @@ public static boolean isLog4jLogger(Class clazz) {
 }
 Logger log = LoggerFactory.getLogger(clazz);
 try {
-  Class log4jClass = Class.forName("org.slf4j.impl.Log4jLoggerAdapter");
+  Class log4jClass = Class.forName("org.slf4j.impl.Log4jLoggerAdapter");

Review Comment:
   make this a constant string and use everywhere it is needed



##
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/GenericsUtil.java:
##
@@ -89,10 +89,30 @@ public static boolean isLog4jLogger(Class clazz) {
 }
 Logger log = LoggerFactory.getLogger(clazz);
 try {
-  Class log4jClass = Class.forName("org.slf4j.impl.Log4jLoggerAdapter");
+  Class log4jClass = Class.forName("org.slf4j.impl.Log4jLoggerAdapter");
   return log4jClass.isInstance(log);
 } catch (ClassNotFoundException e) {
   return false;
 }
   }
+
+  /**
+   * Determine whether the log of the given logger is of Log4J implementation.
+   *
+   * @param logger the logger name, usually class name as string.
+   * @return true if the logger uses Log4J implementation.
+   */
+  public static boolean isLog4jLogger(String logger) {
+if (logger == null) {
+  return false;
+}
+Logger log = LoggerFactory.getLogger(logger);
+try {
+  Class log4jClass = Class.forName("org.slf4j.impl.Log4jLoggerAdapter");

Review Comment:
   if the class isn't found, then that fact can be remembered in an atomic 
boolean so future loads/checks skipped. 





> LogLevel servlet to determine log impl before using setLevel
> 
>
> Key: HADOOP-18653
> URL: https://issues.apache.org/jira/browse/HADOOP-18653
> Project: Hadoop Common
>  Issue Type: Sub-task
>Reporter: Viraj Jasani
>Assignee: Viraj Jasani
>Priority: Major
>  Labels: pull-request-available
>
> LogLevel GET API is used to set log level for a given class name dynamically. 
> While we have cleaned up the commons-logging references, it would be great to 
> determine whether slf4j log4j adapter is in the classpath before allowing 
> client to set the log level.
> Proposed changes:
>  * Use slf4j logger factory to get the log reference for the given class name
>  * Use generic utility to identify if the slf4j log4j adapter is in the 
> classpath before using log4j API to update the log level
>  * If the log4j adapter is not in the classpath, report error in the output



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[jira] [Commented] (HADOOP-18653) LogLevel servlet to determine log impl before using setLevel

2023-03-06 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/HADOOP-18653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17696819#comment-17696819
 ] 

ASF GitHub Bot commented on HADOOP-18653:
-

hadoop-yetus commented on PR #5456:
URL: https://github.com/apache/hadoop/pull/5456#issuecomment-1455795988

   :confetti_ball: **+1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime |  Logfile | Comment |
   |::|--:|:|::|:---:|
   | +0 :ok: |  reexec  |   0m 42s |  |  Docker mode activated.  |
    _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  0s |  |  No case conflicting files 
found.  |
   | +0 :ok: |  codespell  |   0m  1s |  |  codespell was not available.  |
   | +0 :ok: |  detsecrets  |   0m  1s |  |  detect-secrets was not available.  
|
   | +1 :green_heart: |  @author  |   0m  0s |  |  The patch does not contain 
any @author tags.  |
   | +1 :green_heart: |  test4tests  |   0m  0s |  |  The patch appears to 
include 1 new or modified test files.  |
    _ trunk Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |  39m 25s |  |  trunk passed  |
   | +1 :green_heart: |  compile  |  23m  6s |  |  trunk passed with JDK 
Ubuntu-11.0.18+10-post-Ubuntu-0ubuntu120.04.1  |
   | +1 :green_heart: |  compile  |  20m 30s |  |  trunk passed with JDK 
Private Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09  |
   | +1 :green_heart: |  checkstyle  |   1m 13s |  |  trunk passed  |
   | +1 :green_heart: |  mvnsite  |   1m 49s |  |  trunk passed  |
   | +1 :green_heart: |  javadoc  |   1m 13s |  |  trunk passed with JDK 
Ubuntu-11.0.18+10-post-Ubuntu-0ubuntu120.04.1  |
   | +1 :green_heart: |  javadoc  |   0m 50s |  |  trunk passed with JDK 
Private Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09  |
   | +1 :green_heart: |  spotbugs  |   2m 45s |  |  trunk passed  |
   | +1 :green_heart: |  shadedclient  |  22m 38s |  |  branch has no errors 
when building and testing our client artifacts.  |
    _ Patch Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   1m  2s |  |  the patch passed  |
   | +1 :green_heart: |  compile  |  23m 14s |  |  the patch passed with JDK 
Ubuntu-11.0.18+10-post-Ubuntu-0ubuntu120.04.1  |
   | +1 :green_heart: |  javac  |  23m 14s |  |  the patch passed  |
   | +1 :green_heart: |  compile  |  21m 31s |  |  the patch passed with JDK 
Private Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09  |
   | +1 :green_heart: |  javac  |  21m 31s |  |  the patch passed  |
   | +1 :green_heart: |  blanks  |   0m  0s |  |  The patch has no blanks 
issues.  |
   | +1 :green_heart: |  checkstyle  |   1m  6s |  |  the patch passed  |
   | +1 :green_heart: |  mvnsite  |   1m 42s |  |  the patch passed  |
   | +1 :green_heart: |  javadoc  |   1m  6s |  |  the patch passed with JDK 
Ubuntu-11.0.18+10-post-Ubuntu-0ubuntu120.04.1  |
   | +1 :green_heart: |  javadoc  |   0m 51s |  |  the patch passed with JDK 
Private Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09  |
   | +1 :green_heart: |  spotbugs  |   2m 42s |  |  the patch passed  |
   | +1 :green_heart: |  shadedclient  |  22m 33s |  |  patch has no errors 
when building and testing our client artifacts.  |
    _ Other Tests _ |
   | +1 :green_heart: |  unit  |  18m 24s |  |  hadoop-common in the patch 
passed.  |
   | +1 :green_heart: |  asflicense  |   0m 59s |  |  The patch does not 
generate ASF License warnings.  |
   |  |   | 210m  0s |  |  |
   
   
   | Subsystem | Report/Notes |
   |--:|:-|
   | Docker | ClientAPI=1.42 ServerAPI=1.42 base: 
https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-5456/1/artifact/out/Dockerfile
 |
   | GITHUB PR | https://github.com/apache/hadoop/pull/5456 |
   | Optional Tests | dupname asflicense compile javac javadoc mvninstall 
mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets |
   | uname | Linux 0d56583e869a 4.15.0-200-generic #211-Ubuntu SMP Thu Nov 24 
18:16:04 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | dev-support/bin/hadoop.sh |
   | git revision | trunk / b4714dcf9ebe156914b1bf1eac1c4355accca309 |
   | Default Java | Private Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09 |
   | Multi-JDK versions | 
/usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.18+10-post-Ubuntu-0ubuntu120.04.1
 /usr/lib/jvm/java-8-openjdk-amd64:Private 
Build-1.8.0_362-8u362-ga-0ubuntu1~20.04.1-b09 |
   |  Test Results | 
https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-5456/1/testReport/ |
   | Max. process+thread count | 2587 (vs. ulimit of 5500) |
   | modules | C: hadoop-common-project/hadoop-common U: 
hadoop-common-project/hadoop-common |
   | Console output | 
https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-5456/1/console |
   | versions | git=2.25.1 maven=3.6.3 spotbugs=4.2.2 |
   | Powered by | Apache Yetus 0.14.0 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   




> 

[jira] [Commented] (HADOOP-18653) LogLevel servlet to determine log impl before using setLevel

2023-03-05 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/HADOOP-18653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17696706#comment-17696706
 ] 

ASF GitHub Bot commented on HADOOP-18653:
-

virajjasani commented on PR #5456:
URL: https://github.com/apache/hadoop/pull/5456#issuecomment-1455515041

   @Apache9 @jojochuang could you please also take a look?




> LogLevel servlet to determine log impl before using setLevel
> 
>
> Key: HADOOP-18653
> URL: https://issues.apache.org/jira/browse/HADOOP-18653
> Project: Hadoop Common
>  Issue Type: Sub-task
>Reporter: Viraj Jasani
>Assignee: Viraj Jasani
>Priority: Major
>  Labels: pull-request-available
>
> LogLevel GET API is used to set log level for a given class name dynamically. 
> While we have cleaned up the commons-logging references, it would be great to 
> determine whether slf4j log4j adapter is in the classpath before allowing 
> client to set the log level.
> Proposed changes:
>  * Use slf4j logger factory to get the log reference for the given class name
>  * Use generic utility to identify if the slf4j log4j adapter is in the 
> classpath before using log4j API to update the log level
>  * If the log4j adapter is not in the classpath, report error in the output



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[jira] [Commented] (HADOOP-18653) LogLevel servlet to determine log impl before using setLevel

2023-03-05 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/HADOOP-18653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17696704#comment-17696704
 ] 

ASF GitHub Bot commented on HADOOP-18653:
-

virajjasani commented on PR #5456:
URL: https://github.com/apache/hadoop/pull/5456#issuecomment-1455513493

   @steveloughran This PR is a follow-up task from #5315 (comment 
[here](https://github.com/apache/hadoop/pull/5315#discussion_r1081327340))
   
   Could you please review this PR?




> LogLevel servlet to determine log impl before using setLevel
> 
>
> Key: HADOOP-18653
> URL: https://issues.apache.org/jira/browse/HADOOP-18653
> Project: Hadoop Common
>  Issue Type: Sub-task
>Reporter: Viraj Jasani
>Assignee: Viraj Jasani
>Priority: Major
>  Labels: pull-request-available
>
> LogLevel GET API is used to set log level for a given class name dynamically. 
> While we have cleaned up the commons-logging references, it would be great to 
> determine whether slf4j log4j adapter is in the classpath before allowing 
> client to set the log level.
> Proposed changes:
>  * Use slf4j logger factory to get the log reference for the given class name
>  * Use generic utility to identify if the slf4j log4j adapter is in the 
> classpath before using log4j API to update the log level
>  * If the log4j adapter is not in the classpath, report error in the output



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[jira] [Commented] (HADOOP-18653) LogLevel servlet to determine log impl before using setLevel

2023-03-05 Thread ASF GitHub Bot (Jira)


[ 
https://issues.apache.org/jira/browse/HADOOP-18653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17696703#comment-17696703
 ] 

ASF GitHub Bot commented on HADOOP-18653:
-

virajjasani opened a new pull request, #5456:
URL: https://github.com/apache/hadoop/pull/5456

   LogLevel GET API is used to set log level for a given class name 
dynamically. While we have cleaned up the commons-logging references, it would 
be great to determine whether slf4j log4j adapter is in the classpath before 
allowing client to set the log level.
   
   Proposed changes:
   
   - Use slf4j logger factory to get the log reference for the given class name
   - Use generic utility to identify if the slf4j log4j adapter is in the 
classpath before using log4j API to update the log level
   - If the log4j adapter is not in the classpath, report error in the output
   




> LogLevel servlet to determine log impl before using setLevel
> 
>
> Key: HADOOP-18653
> URL: https://issues.apache.org/jira/browse/HADOOP-18653
> Project: Hadoop Common
>  Issue Type: Sub-task
>Reporter: Viraj Jasani
>Assignee: Viraj Jasani
>Priority: Major
>
> LogLevel GET API is used to set log level for a given class name dynamically. 
> While we have cleaned up the commons-logging references, it would be great to 
> determine whether slf4j log4j adapter is in the classpath before allowing 
> client to set the log level.
> Proposed changes:
>  * Use slf4j logger factory to get the log reference for the given class name
>  * Use generic utility to identify if the slf4j log4j adapter is in the 
> classpath before using log4j API to update the log level
>  * If the log4j adapter is not in the classpath, report error in the output



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org