svn commit: r1800457 - in /ofbiz/ofbiz-plugins/trunk: lucene/build.gradle solr/build.gradle solr/config/solrconfig.properties solr/src/main/java/org/apache/ofbiz/solr/webapp/OFBizSolrContextFilter.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1800457 - in /ofbiz/ofbiz-plugins/trunk: lucene/build.gradle solr/build.gradle solr/config/solrconfig.properties solr/src/main/java/org/apache/ofbiz/solr/webapp/OFBizSolrContextFilter.java

jleroux@apache.org
Author: jleroux
Date: Fri Jun 30 20:41:50 2017
New Revision: 1800457

URL: http://svn.apache.org/viewvc?rev=1800457&view=rev
Log:
Improved: Missing Java Option solr.log.dir. Logging may be missing or incomplete
(OFBIZ-9375)

The tip suggested by Jinghai I committed at r1795781 did not work.

This reverts r1795781 and offers a better solid solution.

Byproduct: fixes imports and tabs in OFBizSolrContextFilter.java

Modified:
    ofbiz/ofbiz-plugins/trunk/lucene/build.gradle
    ofbiz/ofbiz-plugins/trunk/solr/build.gradle
    ofbiz/ofbiz-plugins/trunk/solr/config/solrconfig.properties
    ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/webapp/OFBizSolrContextFilter.java

Modified: ofbiz/ofbiz-plugins/trunk/lucene/build.gradle
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/lucene/build.gradle?rev=1800457&r1=1800456&r2=1800457&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/lucene/build.gradle (original)
+++ ofbiz/ofbiz-plugins/trunk/lucene/build.gradle Fri Jun 30 20:41:50 2017
@@ -21,6 +21,3 @@ dependencies {
     pluginLibsCompile 'org.apache.lucene:lucene-queryparser:6.5.1'
     pluginLibsCompile 'org.apache.lucene:lucene-analyzers-common:6.5.1'
 }
-def jvmArguments = ['-Xms128M', '-Xmx1024M',
-    '-Dsolr.log.dir=runtime/logs',
-                    '-Dsolr.log.level=INFO']

Modified: ofbiz/ofbiz-plugins/trunk/solr/build.gradle
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/solr/build.gradle?rev=1800457&r1=1800456&r2=1800457&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/solr/build.gradle (original)
+++ ofbiz/ofbiz-plugins/trunk/solr/build.gradle Fri Jun 30 20:41:50 2017
@@ -19,6 +19,3 @@
 dependencies {
     pluginLibsCompile 'org.apache.solr:solr-core:6.5.1'
 }
-def jvmArguments = ['-Xms128M', '-Xmx1024M',
-'-Dsolr.log.dir=runtime/logs',
-                '-Dsolr.log.level=INFO']

Modified: ofbiz/ofbiz-plugins/trunk/solr/config/solrconfig.properties
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/solr/config/solrconfig.properties?rev=1800457&r1=1800456&r2=1800457&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/solr/config/solrconfig.properties (original)
+++ ofbiz/ofbiz-plugins/trunk/solr/config/solrconfig.properties Fri Jun 30 20:41:50 2017
@@ -45,3 +45,6 @@ solr.client.connection.timeout=
 
 # If true, trust self signed certification, default is false.
 solr.client.trust.selfsigned.cert=true
+
+# Defines Solr specific log directory
+solr.log.dir=/runtime/indexes/solr

Modified: ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/webapp/OFBizSolrContextFilter.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/webapp/OFBizSolrContextFilter.java?rev=1800457&r1=1800456&r2=1800457&view=diff
==============================================================================
--- ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/webapp/OFBizSolrContextFilter.java (original)
+++ ofbiz/ofbiz-plugins/trunk/solr/src/main/java/org/apache/ofbiz/solr/webapp/OFBizSolrContextFilter.java Fri Jun 30 20:41:50 2017
@@ -36,10 +36,6 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 
-import org.apache.solr.common.SolrException;
-import org.apache.solr.core.CoreContainer;
-import org.apache.solr.core.NodeConfig;
-import org.apache.solr.servlet.SolrDispatchFilter;
 import org.apache.ofbiz.base.conversion.ConversionException;
 import org.apache.ofbiz.base.conversion.JSONConverters.MapToJSON;
 import org.apache.ofbiz.base.lang.JSON;
@@ -51,6 +47,10 @@ import org.apache.ofbiz.base.util.UtilTi
 import org.apache.ofbiz.base.util.UtilValidate;
 import org.apache.ofbiz.entity.GenericValue;
 import org.apache.ofbiz.webapp.control.LoginWorker;
+import org.apache.solr.common.SolrException;
+import org.apache.solr.core.CoreContainer;
+import org.apache.solr.core.NodeConfig;
+import org.apache.solr.servlet.SolrDispatchFilter;
 
 /**
  * OFBizSolrContextFilter - Restricts access to solr urls.
@@ -65,6 +65,8 @@ public class OFBizSolrContextFilter exte
      * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
      */
     public void init(FilterConfig config) throws ServletException {
+        Properties props = System.getProperties();
+        props.setProperty("solr.log.dir", UtilProperties.getPropertyValue("solrconfig", "solr.log.dir", "runtime/logs/solr"));
         super.init(config);
     }
 
@@ -112,19 +114,19 @@ public class OFBizSolrContextFilter exte
                 // NOTE: the update requests are defined in an index's solrconfig.xml
                 // get the Solr index name from the request
                 if (UtilValidate.isEmpty(userLogin) || !LoginWorker.hasBasePermission(userLogin, httpRequest)) {
-                 sendJsonHeaderMessage(httpRequest, httpResponse, userLogin, "SolrErrorUpdateLoginFirst", "SolrErrorNoUpdatePermission", locale);
+                    sendJsonHeaderMessage(httpRequest, httpResponse, userLogin, "SolrErrorUpdateLoginFirst", "SolrErrorNoUpdatePermission", locale);
                     return;
                 }
             } else if (servletPath.endsWith("/replication")) {
                 // get the Solr index name from the request
                 if (UtilValidate.isEmpty(userLogin) || !LoginWorker.hasBasePermission(userLogin, httpRequest)) {
-                 sendJsonHeaderMessage(httpRequest, httpResponse, userLogin, "SolrErrorReplicateLoginFirst", "SolrErrorNoReplicatePermission", locale);
+                    sendJsonHeaderMessage(httpRequest, httpResponse, userLogin, "SolrErrorReplicateLoginFirst", "SolrErrorNoReplicatePermission", locale);
                     return;
                 }
             } else if (servletPath.endsWith("/file") || servletPath.endsWith("/file/")) {
                 // get the Solr index name from the request
                 if (UtilValidate.isEmpty(userLogin) || !LoginWorker.hasBasePermission(userLogin, httpRequest)) {
-                 sendJsonHeaderMessage(httpRequest, httpResponse, userLogin, "SolrErrorViewFileLoginFirst", "SolrErrorNoViewFilePermission", locale);
+                    sendJsonHeaderMessage(httpRequest, httpResponse, userLogin, "SolrErrorViewFileLoginFirst", "SolrErrorNoViewFilePermission", locale);
                     return;
                 }
             }
@@ -167,7 +169,7 @@ public class OFBizSolrContextFilter exte
         } catch (SolrException e) {
 //            nodeConfig = loadNodeConfig("plugins/solr/home", extraProperties);
             Path path = Paths.get("plugins/solr/home");
- nodeConfig = loadNodeConfig(path, extraProperties);
+            nodeConfig = loadNodeConfig(path, extraProperties);
         }
         cores = new CoreContainer(nodeConfig, extraProperties, true);
         cores.load();