Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-212 java.util.logging.config.file must be set before getInstanceDir()

Ryan McKinley9ecad14adf4b
diff --git a/src/webapp/src/org/apache/solr/servlet/DirectSolrConnection.java b/src/webapp/src/org/apache/solr/servlet/DirectSolrConnection.java
index 04baf88e4a4..0a161d6e1c6 100644
--- a/src/webapp/src/org/apache/solr/servlet/DirectSolrConnection.java
+++ b/src/webapp/src/org/apache/solr/servlet/DirectSolrConnection.java
@@ -86,22 +86,11 @@ public class DirectSolrConnection
*/
public DirectSolrConnection( String instanceDir, String dataDir, String loggingPath )
{
- // Set the instance directory
- if( instanceDir != null ) {
- if( Config.isInstanceDirInitialized() ) {
- String dir = Config.getInstanceDir();
- if( !dir.equals( instanceDir ) ) {
- throw new SolrException( 500, "already initalized: "+dir );
- }
- }
- Config.setInstanceDir( instanceDir );
- }
-
- // If a loggingPath is specified, try using that
+ // If a loggingPath is specified, try using that (this needs to happen first)
if( loggingPath != null ) {
File loggingConfig = new File( loggingPath );
- if( !loggingConfig.exists() ) {
- loggingConfig = new File( new File(Config.getInstanceDir()), loggingPath );
+ if( !loggingConfig.exists() && instanceDir != null ) {
+ loggingConfig = new File( new File(instanceDir), loggingPath );
}
if( loggingConfig.exists() ) {
System.setProperty("java.util.logging.config.file", loggingConfig.getAbsolutePath() );
@@ -111,6 +100,17 @@ public class DirectSolrConnection
}
}
+ // Set the instance directory
+ if( instanceDir != null ) {
+ if( Config.isInstanceDirInitialized() ) {
+ String dir = Config.getInstanceDir();
+ if( !dir.equals( instanceDir ) ) {
+ throw new SolrException( 500, "already initalized: "+dir );
+ }
+ }
+ Config.setInstanceDir( instanceDir );
+ }
+
// If the Data directory is specified, initalize SolrCore directly
if( dataDir != null ) {
core = new SolrCore( dataDir, new IndexSchema(instanceDir+"/conf/schema.xml"));