cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Tsvinev (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-971) simplify configuration file loading
Date Sun, 24 Apr 2011 06:47:05 GMT


Oleg Tsvinev commented on CASSANDRA-971:

I see PropertyConfigurator still there, as of version 0.7.4. 

public abstract class AbstractCassandraDaemon implements CassandraDaemon
    //Initialize logging in such a way that it checks for config changes every 10 seconds.
        String config = System.getProperty("log4j.configuration", "");
        URL configLocation = null;
            // try loading from a physical location first.
            configLocation = new URL(config);
        catch (MalformedURLException ex) 
            // load from the classpath.
            configLocation = AbstractCassandraDaemon.class.getClassLoader().getResource(config);
            if (configLocation == null)
                throw new RuntimeException("Couldn't figure out log4j configuration.");
--->    PropertyConfigurator.configureAndWatch(configLocation.getFile(), 10000);
        org.apache.log4j.Logger.getLogger(AbstractCassandraDaemon.class).info("Logging initialized");

    private static Logger logger = LoggerFactory.getLogger(AbstractCassandraDaemon.class);

> simplify configuration file loading
> -----------------------------------
>                 Key: CASSANDRA-971
>                 URL:
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Jonathan Ellis
>            Assignee: Jonathan Ellis
>            Priority: Minor
>             Fix For: 0.7 beta 1
>         Attachments: 971.txt
> Currently we can load the configuration file from (a) a full path specified by -Dstorage-config,
or (b) "storage.conf.xml" located anywhere on the classpath (filename may not be changed).
> I think we should figure out what The Right Thing is to do here, and then do it, instead
of trying multiple guesses in an effort to prevent ... what?
> ISTM that the java idiom here is, look for a default filename on the classpath, and allow
customizing that name w/ a system property, but when taking the property ONLY the filename
is customized, not the full path.  This is what log4j does, for instance.

This message is automatically generated by JIRA.
For more information on JIRA, see:

View raw message