You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Oleg Tsvinev (JIRA)" <ji...@apache.org> on 2011/04/24 08:47:05 UTC

[jira] [Commented] (CASSANDRA-971) simplify configuration file loading

    [ https://issues.apache.org/jira/browse/CASSANDRA-971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13023638#comment-13023638 ] 

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.
    static
    {
        String config = System.getProperty("log4j.configuration", "log4j-server.properties");
        URL configLocation = null;
        try 
        {
            // 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: https://issues.apache.org/jira/browse/CASSANDRA-971
>             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: http://www.atlassian.com/software/jira