You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ma...@apache.org on 2026/02/19 23:28:33 UTC

(ranger) branch master updated: RANGER-5495: replaced org.apache.log4j references with org.slf4j (#856)

This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git


The following commit(s) were added to refs/heads/master by this push:
     new 531b05707 RANGER-5495: replaced org.apache.log4j references with org.slf4j (#856)
531b05707 is described below

commit 531b057071d1de94d0f27cb4977de5790c460abf
Author: Madhan Neethiraj <ma...@apache.org>
AuthorDate: Thu Feb 19 13:59:05 2026 -0800

    RANGER-5495: replaced org.apache.log4j references with org.slf4j (#856)
    
    (cherry picked from commit 8e6f39509fd0915e6661a0e6b018b14e3d6113f6)
---
 .../apache/ranger/patch/PatchForTrinoSvcDefUpdate_J10062.java | 11 ++++++-----
 .../ranger/security/web/filter/RangerJwtAuthFilter.java       |  7 ++++---
 .../ranger/security/web/filter/RangerJwtAuthWrapper.java      |  9 ++++-----
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/security-admin/src/main/java/org/apache/ranger/patch/PatchForTrinoSvcDefUpdate_J10062.java b/security-admin/src/main/java/org/apache/ranger/patch/PatchForTrinoSvcDefUpdate_J10062.java
index 6a88d8175..4302608cf 100644
--- a/security-admin/src/main/java/org/apache/ranger/patch/PatchForTrinoSvcDefUpdate_J10062.java
+++ b/security-admin/src/main/java/org/apache/ranger/patch/PatchForTrinoSvcDefUpdate_J10062.java
@@ -19,7 +19,6 @@
 package org.apache.ranger.patch;
 
 import org.apache.commons.collections.CollectionUtils;
-import org.apache.log4j.Logger;
 import org.apache.ranger.biz.ServiceDBStore;
 import org.apache.ranger.common.GUIDUtil;
 import org.apache.ranger.common.RangerValidatorFactory;
@@ -32,6 +31,8 @@
 import org.apache.ranger.plugin.model.validation.RangerValidator.Action;
 import org.apache.ranger.plugin.store.EmbeddedServiceDefsUtil;
 import org.apache.ranger.util.CLIUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
@@ -46,7 +47,7 @@
 
 @Component
 public class PatchForTrinoSvcDefUpdate_J10062 extends BaseLoader {
-    private static final Logger logger = Logger.getLogger(PatchForTrinoSvcDefUpdate_J10062.class);
+    private static final Logger logger = LoggerFactory.getLogger(PatchForTrinoSvcDefUpdate_J10062.class);
 
     public static final String LOGIN_ID_ADMIN                              = "admin";
     public static final String WILDCARD_ASTERISK                           = "*";
@@ -229,7 +230,7 @@ private void createDefaultPolicies(RangerServiceDef dbRangerServiceDef) throws E
     }
 
     private void addDefaultPolicies(String serviceName, String zoneName) throws Exception {
-        logger.info("===> addDefaultPolicies ServiceName : " + serviceName + " ZoneName : " + zoneName);
+        logger.info("===> addDefaultPolicies ServiceName : {} ZoneName : {}", serviceName, zoneName);
 
         List<String> resources = new ArrayList<>();
 
@@ -323,8 +324,8 @@ private RangerPolicy getPolicy(String serviceName, String zoneName, String polic
         policy.setPolicyItems(policyItems);
         policy.setResourceSignature(new RangerPolicyResourceSignature(policy).getSignature());
 
-        logger.debug("===> getPolicy policy ResourceSignature  " + policy.getResourceSignature());
-        logger.debug("===> getPolicy policy : " + policy);
+        logger.debug("===> getPolicy policy ResourceSignature  {}", policy.getResourceSignature());
+        logger.debug("===> getPolicy policy : {}", policy);
         logger.info("<=== getPolicy ");
 
         return policy;
diff --git a/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerJwtAuthFilter.java b/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerJwtAuthFilter.java
index b10238b51..a43cc30ce 100644
--- a/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerJwtAuthFilter.java
+++ b/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerJwtAuthFilter.java
@@ -18,11 +18,12 @@
  */
 package org.apache.ranger.security.web.filter;
 
-import org.apache.log4j.Logger;
 import org.apache.ranger.authz.handler.RangerAuth;
 import org.apache.ranger.authz.handler.jwt.RangerDefaultJwtAuthHandler;
 import org.apache.ranger.authz.handler.jwt.RangerJwtAuthHandler;
 import org.apache.ranger.common.PropertiesUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.security.authentication.AbstractAuthenticationToken;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -52,7 +53,7 @@
 @Lazy(true)
 @Component
 public class RangerJwtAuthFilter extends RangerDefaultJwtAuthHandler implements Filter {
-    private static final Logger LOG = Logger.getLogger(RangerJwtAuthFilter.class);
+    private static final Logger LOG = LoggerFactory.getLogger(RangerJwtAuthFilter.class);
 
     private static final String DEFAULT_RANGER_ROLE = "ROLE_USER";
 
@@ -109,7 +110,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
 
         if (auth != null) {
             if (LOG.isDebugEnabled()) {
-                LOG.debug("<<<=== RangerJwtAuthFilter.doFilter() - user=[" + auth.getPrincipal() + "], isUserAuthenticated? [" + auth.isAuthenticated() + "]");
+                LOG.debug("<<<=== RangerJwtAuthFilter.doFilter() - user=[{}], isUserAuthenticated? [{}]", auth.getPrincipal(), auth.isAuthenticated());
             }
         } else {
             LOG.warn("<<<=== RangerJwtAuthFilter.doFilter() - Failed to authenticate request using Ranger JWT authentication framework.");
diff --git a/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerJwtAuthWrapper.java b/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerJwtAuthWrapper.java
index 8d442f53e..c87f2c703 100644
--- a/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerJwtAuthWrapper.java
+++ b/security-admin/src/main/java/org/apache/ranger/security/web/filter/RangerJwtAuthWrapper.java
@@ -19,11 +19,12 @@
 package org.apache.ranger.security.web.filter;
 
 import org.apache.commons.lang3.StringUtils;
-import org.apache.log4j.Logger;
 import org.apache.ranger.common.PropertiesUtil;
 import org.apache.ranger.common.UserSessionBase;
 import org.apache.ranger.security.context.RangerContextHolder;
 import org.apache.ranger.security.context.RangerSecurityContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.security.core.Authentication;
@@ -44,7 +45,7 @@
 @Lazy(true)
 @Component
 public class RangerJwtAuthWrapper extends GenericFilterBean {
-    private static final Logger LOG = Logger.getLogger(RangerJwtAuthWrapper.class);
+    private static final Logger LOG = LoggerFactory.getLogger(RangerJwtAuthWrapper.class);
 
     @Lazy(true)
     @Autowired
@@ -69,9 +70,7 @@ public void initialize() {
 
     @Override
     public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("===>>> RangerJwtAuthWrapper.doFilter(" + request + ", " + response + ", " + filterChain + ")");
-        }
+        LOG.debug("===>>> RangerJwtAuthWrapper.doFilter({}, {}, {})", request, response, filterChain);
 
         RangerSecurityContext context             = RangerContextHolder.getSecurityContext();
         UserSessionBase       session             = context != null ? context.getUserSession() : null;