You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Aled Sage (JIRA)" <ji...@apache.org> on 2013/09/11 00:17:51 UTC

[jira] [Commented] (CASSANDRA-5877) Unclear FileNotFoundException stacktrace when system.log can't be created

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

Aled Sage commented on CASSANDRA-5877:
--------------------------------------

This looks buried in org.apache.log4j code, so I think better to fix it there (and thus raise it as an issue there).

I'm new to this code but looks like... CassandraDaemon just passes in the config file (e.g. log4j-server.properties) which has a property "log4j.appender.R.File=/var/log/cassandra/system.log". So the file's path and its meaning are buried inside log4j. The only ways I see to fix this issue in cassandra would be:
1. catch the FileNotFoundException (checking the exception text, perhaps) to log an additional explanation; or
2. parse this config file and then check if we can create the given log file.

Both of these sound like bad ideas to me.

Thoughts?
                
> Unclear FileNotFoundException stacktrace when system.log can't be created
> -------------------------------------------------------------------------
>
>                 Key: CASSANDRA-5877
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5877
>             Project: Cassandra
>          Issue Type: Bug
>         Environment: Cassandra 2.0rc1
>            Reporter: Michaël Figuière
>            Priority: Trivial
>
> When you start Cassandra with default settings without the appropriate permissions to write in {{/var/log/cassandra}} you end up with the following stacktrace:
> {code}
> log4j:ERROR setFile(null,true) call failed.
> java.io.FileNotFoundException: /var/log/cassandra/system.log (No such file or directory)
> 	at java.io.FileOutputStream.open(Native Method)
> 	at java.io.FileOutputStream.<init>(FileOutputStream.java:206)
> 	at java.io.FileOutputStream.<init>(FileOutputStream.java:127)
> 	at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
> 	at org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java:207)
> 	at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
> 	at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307)
> 	at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:172)
> 	at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:104)
> 	at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:809)
> 	at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:735)
> 	at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:615)
> 	at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:502)
> 	at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:395)
> 	at org.apache.log4j.PropertyWatchdog.doOnChange(PropertyConfigurator.java:922)
> 	at org.apache.log4j.helpers.FileWatchdog.checkAndConfigure(FileWatchdog.java:89)
> 	at org.apache.log4j.helpers.FileWatchdog.<init>(FileWatchdog.java:58)
> 	at org.apache.log4j.PropertyWatchdog.<init>(PropertyConfigurator.java:914)
> 	at org.apache.log4j.PropertyConfigurator.configureAndWatch(PropertyConfigurator.java:461)
> 	at org.apache.cassandra.service.CassandraDaemon.initLog4j(CassandraDaemon.java:121)
> 	at org.apache.cassandra.service.CassandraDaemon.<clinit>(CassandraDaemon.java:69)
> {code}
> While a stacktrace at startup may not be the most elegant mean of communication with the user - though at least it's visible - in this situation it doesn't make it clear that Cassandra couldn't create a file in the specified log directory.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira