cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Allsopp (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-2383) log4j unable to load properties file from classpath
Date Tue, 28 Jun 2011 22:31:29 GMT

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

David Allsopp commented on CASSANDRA-2383:
------------------------------------------

Suggested fix for AbstractCassandraDaemon static initializer (apologies - haven't got a suitable
version of diff on this windows box yet). Untested on linux as yet.

{noformat}
    //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");
        String configFileName = null;
        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.");
			try
			{
				configFileName = new File(configLocation.toURI()).getCanonicalPath();
			} 
			catch (Exception e)
			{
				throw new RuntimeException("Couldn't convert log4j configuration location to a valid file.",
e);
			} 
        }
        PropertyConfigurator.configureAndWatch(configFileName, 10000);
        org.apache.log4j.Logger.getLogger(AbstractCassandraDaemon.class).info("Logging initialized");
    }
{noformat}

> log4j unable to load properties file from classpath
> ---------------------------------------------------
>
>                 Key: CASSANDRA-2383
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2383
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Tools
>    Affects Versions: 0.7.4
>         Environment: OS : windows
> java : 1.6.0.23
>            Reporter: david lee
>            Assignee: T Jake Luciani
>            Priority: Minor
>             Fix For: 0.7.7
>
>
> when cassandra home folder is placed inside a folder which has space characters in its
name,
> log4j settings are not properly loaded and warning messages are shown.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message