Reduce log statement to 1 line using
authorrjung <rjung@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 4 Sep 2008 07:02:33 +0000 (07:02 +0000)
committerrjung <rjung@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 4 Sep 2008 07:02:33 +0000 (07:02 +0000)
more precise info, in the expected case and only
log the detailed info in the unexpected case.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@691887 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/juli/ClassLoaderLogManager.java

index 9156e8b..ccfd6ab 100644 (file)
@@ -19,11 +19,13 @@ package org.apache.juli;
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FilePermission;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URLClassLoader;
 import java.security.AccessControlException;
 import java.security.AccessController;
+import java.security.Permission;
 import java.security.PrivilegedAction;
 import java.util.Collections;
 import java.util.Enumeration;
@@ -308,10 +310,15 @@ public class ClassLoaderLogManager extends LogManager {
             if (info != null) {
                 Logger log = info.loggers.get("");
                 if (log != null) {
-                        log.warning("You need to permit read access to your context specific java.util.logging logging configuration to " + ClassLoaderLogManager.class);
-                        log.warning("See \"per context logging\" in the default catalina.policy file.");
+                    Permission perm = ace.getPermission();
+                    if (perm instanceof FilePermission && perm.getActions().equals("read")) {
+                        log.warning("Reading " + perm.getName() + " is not permitted. See \"per context logging\" in the default catalina.policy file.");
+                    }
+                    else {
+                        log.warning("Reading logging.properties is not permitted in some context. See \"per context logging\" in the default catalina.policy file.");
                         log.warning("Original error was: " + ace.getMessage());
-               }
+                    }
+                }
             }
         }
         if ((is == null) && (classLoader == ClassLoader.getSystemClassLoader())) {