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

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

commit fd9e03fd3d364649ad21c16efd5c3525ee93c3c1
Author: Guru Thejus Arveti <[email protected]>
AuthorDate: Tue Nov 5 11:23:51 2024 +0530

    RANGER-4982: Reducing few ranger plugin logs to debug level
    
    Change-Id: I951225f2cd2c76f063c587303d5ee1a7557641f0
    Signed-off-by: Pradeep Agrawal <[email protected]>
---
 .../apache/ranger/audit/provider/MultiDestAuditProvider.java |  6 ++++--
 .../authorization/hadoop/config/RangerConfiguration.java     |  8 ++++++--
 .../org/apache/ranger/plugin/util/RangerPolicyDeltaUtil.java |  8 ++++++--
 .../plugin/classloader/RangerPluginClassLoaderUtil.java      | 12 +++++++++---
 .../src/main/java/org/apache/ranger/biz/ServiceMgr.java      |  8 ++++++--
 5 files changed, 31 insertions(+), 11 deletions(-)

diff --git 
a/agents-audit/src/main/java/org/apache/ranger/audit/provider/MultiDestAuditProvider.java
 
b/agents-audit/src/main/java/org/apache/ranger/audit/provider/MultiDestAuditProvider.java
index b2e43c3be..5ac8c0ee0 100644
--- 
a/agents-audit/src/main/java/org/apache/ranger/audit/provider/MultiDestAuditProvider.java
+++ 
b/agents-audit/src/main/java/org/apache/ranger/audit/provider/MultiDestAuditProvider.java
@@ -87,8 +87,10 @@ public class MultiDestAuditProvider extends BaseAuditHandler 
{
 
        public void addAuditProvider(AuditHandler provider) {
                if (provider != null) {
-                       
LOG.info("MultiDestAuditProvider.addAuditProvider(providerType="
-                                       + 
provider.getClass().getCanonicalName() + ")");
+                       if(LOG.isDebugEnabled()) {
+                               
LOG.debug("MultiDestAuditProvider.addAuditProvider(providerType="
+                                               + 
provider.getClass().getCanonicalName() + ")");
+                       }
 
                        mProviders.add(provider);
                        if (provider instanceof BaseAuditHandler) {
diff --git 
a/agents-common/src/main/java/org/apache/ranger/authorization/hadoop/config/RangerConfiguration.java
 
b/agents-common/src/main/java/org/apache/ranger/authorization/hadoop/config/RangerConfiguration.java
index 9479b88dd..e8937edd5 100644
--- 
a/agents-common/src/main/java/org/apache/ranger/authorization/hadoop/config/RangerConfiguration.java
+++ 
b/agents-common/src/main/java/org/apache/ranger/authorization/hadoop/config/RangerConfiguration.java
@@ -47,7 +47,9 @@ public class RangerConfiguration extends Configuration {
 
                URL fUrl = getFileLocation(aResourceName);
                if (fUrl != null) {
-                       LOG.info("addResourceIfReadable(" + aResourceName + "): 
resource file is " + fUrl);
+                       if(LOG.isDebugEnabled()) {
+                               LOG.debug("addResourceIfReadable(" + 
aResourceName + "): resource file is " + fUrl);
+                       }
                        try {
                                addResource(fUrl);
                                ret = true;
@@ -58,7 +60,9 @@ public class RangerConfiguration extends Configuration {
                                }
                        }
                } else {
-                       LOG.error("addResourceIfReadable(" + aResourceName + 
"): couldn't find resource file location");
+                       if(LOG.isDebugEnabled()) {
+                               LOG.debug("addResourceIfReadable(" + 
aResourceName + "): couldn't find resource file location");
+                       }
                }
 
                if(LOG.isDebugEnabled()) {
diff --git 
a/agents-common/src/main/java/org/apache/ranger/plugin/util/RangerPolicyDeltaUtil.java
 
b/agents-common/src/main/java/org/apache/ranger/plugin/util/RangerPolicyDeltaUtil.java
index b47888e9a..d92427217 100644
--- 
a/agents-common/src/main/java/org/apache/ranger/plugin/util/RangerPolicyDeltaUtil.java
+++ 
b/agents-common/src/main/java/org/apache/ranger/plugin/util/RangerPolicyDeltaUtil.java
@@ -198,11 +198,15 @@ public class RangerPolicyDeltaUtil {
 
             if (isPoliciesExist && isPolicyDeltasExist) {
                 LOG.warn("ServicePolicies contain both policies and 
policy-deltas!! Cannot build policy-engine from these servicePolicies. Please 
check server-side code!");
-                LOG.warn("Downloaded ServicePolicies are [" + servicePolicies 
+ "]");
+                if(LOG.isDebugEnabled()) {
+                    LOG.debug("Downloaded ServicePolicies are [" + 
servicePolicies + "]");
+                }
                 ret = null;
             } else if (!isPoliciesExist && !isPolicyDeltasExist) {
                 LOG.warn("ServicePolicies do not contain any policies or 
policy-deltas!!");
-                LOG.warn("Downloaded ServicePolicies are [" + servicePolicies 
+ "]");
+                if(LOG.isDebugEnabled()) {
+                    LOG.debug("Downloaded ServicePolicies are [" + 
servicePolicies + "]");
+                }
                 if (servicePolicies.getPolicyDeltas() == null) {
                     if (LOG.isDebugEnabled()) {
                         LOG.debug("Complete set of servicePolicies is 
received. There may be a change to service. Forcing to create a new policy 
engine!");
diff --git 
a/ranger-plugin-classloader/src/main/java/org/apache/ranger/plugin/classloader/RangerPluginClassLoaderUtil.java
 
b/ranger-plugin-classloader/src/main/java/org/apache/ranger/plugin/classloader/RangerPluginClassLoaderUtil.java
index 366eb5359..b2e2b53f8 100644
--- 
a/ranger-plugin-classloader/src/main/java/org/apache/ranger/plugin/classloader/RangerPluginClassLoaderUtil.java
+++ 
b/ranger-plugin-classloader/src/main/java/org/apache/ranger/plugin/classloader/RangerPluginClassLoaderUtil.java
@@ -103,12 +103,16 @@ public class RangerPluginClassLoaderUtil {
                                        for(File dirFile : dirFiles) {
                                                try {
                                                        if (!dirFile.canRead()) 
{
-                                                               
LOG.error("getFilesInDirectory('" + dirPath + "'): " + 
dirFile.getAbsolutePath() + " is not readable!");
+                                                               
if(LOG.isDebugEnabled()) {
+                                                                       
LOG.debug("getFilesInDirectory('" + dirPath + "'): " + 
dirFile.getAbsolutePath() + " is not readable!");
+                                                               }
                                                        }
 
                                                        URL jarPath = 
dirFile.toURI().toURL();
 
-                                                       
LOG.info("getFilesInDirectory('" + dirPath + "'): adding " + 
dirFile.getAbsolutePath());
+                                                       
if(LOG.isDebugEnabled()) {
+                                                               
LOG.debug("getFilesInDirectory('" + dirPath + "'): adding " + 
dirFile.getAbsolutePath());
+                                                       }
 
                                                        files.add(jarPath);
                                                } catch(Exception excp) {
@@ -120,7 +124,9 @@ public class RangerPluginClassLoaderUtil {
                                LOG.warn("getFilesInDirectory('" + dirPath + 
"'): error", excp);
                        }
                } else {
-                               LOG.warn("getFilesInDirectory('" + dirPath + 
"'): could not find directory in path " + dirPath);
+                       if(LOG.isDebugEnabled()) {
+                               LOG.debug("getFilesInDirectory('" + dirPath + 
"'): could not find directory in path " + dirPath);
+                       }
                }
 
                if(LOG.isDebugEnabled()) {
diff --git a/security-admin/src/main/java/org/apache/ranger/biz/ServiceMgr.java 
b/security-admin/src/main/java/org/apache/ranger/biz/ServiceMgr.java
index f0905542c..8108b71ed 100755
--- a/security-admin/src/main/java/org/apache/ranger/biz/ServiceMgr.java
+++ b/security-admin/src/main/java/org/apache/ranger/biz/ServiceMgr.java
@@ -495,7 +495,9 @@ public class ServiceMgr {
                                                try {
                                                        URL jarPath = 
dirFile.toURI().toURL();
 
-                                                       
LOG.warn("getFilesInDirectory('" + dirPath + "'): adding " + 
dirFile.getAbsolutePath());
+                                                       if 
(LOG.isDebugEnabled()) {
+                                                               
LOG.debug("getFilesInDirectory('" + dirPath + "'): adding " + 
dirFile.getAbsolutePath());
+                                                       }
        
                                                        files.add(jarPath);
                                                } catch(Exception excp) {
@@ -507,7 +509,9 @@ public class ServiceMgr {
                                LOG.warn("getFilesInDirectory('" + dirPath + 
"'): error", excp);
                        }
                } else {
-                               LOG.warn("getFilesInDirectory('" + dirPath + 
"'): could not find directory in CLASSPATH");
+                       if (LOG.isDebugEnabled()) {
+                               LOG.debug("getFilesInDirectory('" + dirPath + 
"'): could not find directory in CLASSPATH");
+                       }
                }
 
                if(LOG.isDebugEnabled()) {

Reply via email to