logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Danielson <sdani...@riverdelta.com>
Subject RE: Running log4j in untrusted applets
Date Mon, 26 Mar 2001 14:38:49 GMT

Good, I put this patch in for 1.04.  When
1.1 comes out I will gladly upgrade and
toss out my patch.

Thanks for such a useful product!
Steve

-----Original Message-----
From: Ceki Gülcü [mailto:cgu@qos.ch]
Sent: Friday, March 23, 2001 5:47 PM
To: LOG4J Developers Mailing List
Subject: Re: Running log4j in untrusted applets


Steve,


Unless I am mistaken this has been already fixed in 1.1b1. Ceki

At 16:52 23.03.2001 -0500, you wrote:

>I could not run log4j in untrusted applets until I added this
>patch to Category.   The difficulty was that the code was
>handling a security exception in the first check to System.getProperty()
>correctly, but then turned around and issued another check to
>System.getProperty()
>without any SecurityException handling code!
>
>Anyway a simple little fix, included for those who are interested in it.
>
>Thanks!
>Steve
>
>  /** Search for the properties file log4j.properties in the CLASSPATH.  */
>  static {
>    String override = null;
>    try {
>      override=System.getProperty(DEFAULT_INIT_OVERRIDE_KEY, override);
>    } catch(SecurityException e) {
>      LogLog.debug("Could not read system property \""+
>                           DEFAULT_INIT_OVERRIDE_KEY +
>                           "\", assuming default value of false.", e);
>    }
>    // if there is no default init override, them get the resource
>    // specified by the user or the default config file.
>    if(override == null || "false".equalsIgnoreCase(override)) {
>      // Handle security exception again
>      String resource = null;
>      try {
>        resource = System.getProperty(DEFAULT_CONFIGURATION_KEY,
>                                           DEFAULT_CONFIGURATION_FILE);
>      } catch(SecurityException e) {
>        LogLog.debug("Could not read system property \""+
>                             DEFAULT_CONFIGURATION_KEY +
>                             "\", assuming default configuration file \"" +
>                             DEFAULT_CONFIGURATION_FILE + "\".", e);
>        resource = DEFAULT_CONFIGURATION_FILE;
>      }
>      URL url = null;
>      try {
>        url = new URL(resource);
>      } catch (MalformedURLException ex) {
>        // so, resource is not a URL:
>        // attempt to get the resource in the most generic way:
>        url = Category.class.getResource(resource);
>        if(url == null) {
>          // if that doen't work, then try again in a slightly
>          // different way
>          ClassLoader loader = Category.class.getClassLoader();
>          if(loader != null) {
>            url = loader.getResource(resource);
>          }
>        }
>      }
>
>      // If we have a non-null url, then delegate the rest of the
>      // configuration to the OptionConverter.selectAndConfigure
>      // method.
>      if(url != null) {
>        OptionConverter.selectAndConfigure(url, defaultHierarchy);
>      } else {
>        LogLog.debug("Could not find resource: ["+resource+"].");
>      }
>    }
>  }
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-dev-help@jakarta.apache.org


I hope to see you at my ApacheCon 2001 presentation 
entitled "Log4j, A Logging Package for Java".

See http://ApacheCon.Com/2001/US/ for more details.

--
Ceki Gülcü          Web: http://qos.ch     
                email: cgu@qos.ch (preferred)
                         ceki_gulcu@yahoo.com


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-dev-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-dev-help@jakarta.apache.org


Mime
View raw message