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

David Allsopp edited comment on CASSANDRA-2383 at 7/2/11 9:27 AM:
------------------------------------------------------------------

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");
        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: "+config);
        
        String configFileName = null;
                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}

      was (Author: dallsopp):
    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

        

Reply via email to