[jira] [Commented] (CASSANDRA-2383) log4j unable to load properties file from classpath

2011-07-12 Thread Hudson (JIRA)

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

Hudson commented on CASSANDRA-2383:
---

Integrated in Cassandra-0.7 #527 (See 
[https://builds.apache.org/job/Cassandra-0.7/527/])
support spaces in path to log4j configuration
patch by David Allsopp; reviewed by jbellis for CASSANDRA-2383

jbellis : 
http://svn.apache.org/viewcvs.cgi/?root=Apache-SVNview=revrev=1145849
Files : 
* /cassandra/branches/cassandra-0.7/CHANGES.txt
* 
/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
* 
/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/service/AbstractCassandraDaemon.java


 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.6
 Environment: OS : windows
 java : 1.6.0.23
Reporter: david lee
Assignee: David Allsopp
Priority: Minor
 Fix For: 0.7.8

 Attachments: cassandra-0.7.6-2-2383.diff


 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




[jira] [Commented] (CASSANDRA-2383) log4j unable to load properties file from classpath

2011-07-02 Thread David Allsopp (JIRA)

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

David Allsopp commented on CASSANDRA-2383:
--

OK, have edited the code snippet above to hopefully fix the obvious 
broken-ness! 

Still struggling to get Cassandra building properly on Windows/Eclipse so 
haven't yet been able to test properly though (need to work through 
http://wiki.apache.org/cassandra/RunningCassandraInEclipse again from scratch 
as it didn't seem to work first time round...)

 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




[jira] [Commented] (CASSANDRA-2383) log4j unable to load properties file from classpath

2011-07-02 Thread David Allsopp (JIRA)

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

David Allsopp commented on CASSANDRA-2383:
--

The above code seems to work for full hierarchical URIs:

-Dlog4j.configuration=file:///C:/conf%20space/log4j-server.properties

and for classpath locations:

-Dlog4j.configuration=log4j-server.properties

(on windows, with a space in the file path)

It does not work for opaque URIs such as file:log4j-server.properties because 
you can't construct a File directly from these (you get 
java.lang.IllegalArgumentException: URI is not hierarchical)

 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




[jira] [Commented] (CASSANDRA-2383) log4j unable to load properties file from classpath

2011-07-02 Thread David Allsopp (JIRA)

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

David Allsopp commented on CASSANDRA-2383:
--

OK, third time lucky I hope. The edited version above now tries the original 
getFile() approach, then falls back on the new File(url.toURI()) approach if 
the file doesn't exist.

This seems to work with classpath names, opaque URIs *and* hierarchical URIs

 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




[jira] [Commented] (CASSANDRA-2383) log4j unable to load properties file from classpath

2011-06-29 Thread David Allsopp (JIRA)

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

David Allsopp commented on CASSANDRA-2383:
--

Yes, that'll teach me to post code late at night :-(

 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




[jira] [Commented] (CASSANDRA-2383) log4j unable to load properties file from classpath

2011-06-28 Thread David Allsopp (JIRA)

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

David Allsopp commented on CASSANDRA-2383:
--

OK, have gone around in circles a bit on this!

-Dlog4j.defaultInitOverride enables AbstractCassandraDaemon to take charge of 
the log4j configuration in order to make it dynamic (you can change the log4j 
config file, and it should be updated using the log4j PropertyConfigurator 
every 10 seconds).

The default value of log4j.configuration in the code and in the batch file is 
log4j-server.properties, which is not a valid URL, so we drop into:

{noformat} 
configLocation = 
AbstractCassandraDaemon.class.getClassLoader().getResource(config);
{noformat} 

as you said before. This *does* detect the correct file from 
CASSANDRA_HOME/conf, since log4j logs the *full path* even though we only 
supply the filename log4j-server.properties:

{noformat} 
log4j: 
[/C:/Users/David/Key%20Value/apache-cassandra-0.7.6-2/conf/log4j-server.properties]
 does not exist.
{noformat} 

getResource() returns a URL. Converting this to a file using getFile() works 
fine when there are no spaces, and you can verify that the file exists. If 
there are spaces, then this conversion produces a filename that includes the 
%20 encoding for spaces - this is an incorrect filename.

We need instead to convert using:

{noformat} 
new File(configLocation.toURI());
{noformat} 

(with appropriate exception handling for URISyntaxException) which produces a 
filename with spaces rather than %20.


 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




[jira] [Commented] (CASSANDRA-2383) log4j unable to load properties file from classpath

2011-06-28 Thread David Allsopp (JIRA)

[ 
https://issues.apache.org/jira/browse/CASSANDRA-2383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=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, 1);

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




[jira] [Commented] (CASSANDRA-2383) log4j unable to load properties file from classpath

2011-06-28 Thread Jonathan Ellis (JIRA)

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

Jonathan Ellis commented on CASSANDRA-2383:
---

Looks like this breaks configuration parameter is a well-formed url?  
configLocation is never used if new URL succeeds.

 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




[jira] [Commented] (CASSANDRA-2383) log4j unable to load properties file from classpath

2011-06-27 Thread David Allsopp (JIRA)

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

David Allsopp commented on CASSANDRA-2383:
--

@Jonathan - will try to take a look soon. The getResource() stuff might perhaps 
be affected by the classes being within a jarfile.

 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