Recently when using SOLR, the configuration will have some problems, log in the print out the logs, but still do not know why such errors occurred. So want to learn the relevant SOLR source code, the following is how to build SOLR debugging environment steps.
SOLR debugging environment to build, first download source code.
Various versions of the source code can be downloaded via http://archive.apache.org/dist/lucene/solr/. You can also download the latest SOLR code on GitHub at: HTTPS://GITHUB.COM/JENISS/LUCENE-SOLR.
Source Code Import IntelliJ Idea
After downloading the SOLR project, you can find it managed with Ant. So you need to make sure that Ant is installed. ant:http://ant.apache.org/bindownload.cgi. Configure ant in the environment variable. Ant_home:d:\program Files (x86) \java\apache-ant-1.9.7,path:%ant_home%\bin. After the configuration is complete, the ant-version is executed, and the ant version is displayed, indicating that the installation was successful.
Next, the SOLR source code is compiled into the project of idea.
Under the root directory, run the ant command to see what Ant can do.
When we execute ant idea, we can compile the SOLR source code into the IntelliJ idea project. It may fail when compiling ant idea, which is the ability to run ant ivy-bootstrap.
After the compilation is successful, it is imported in IntelliJ idea by open mode. When you select the LUCENE-SOLR parent project, the project is imported as a whole.
-
At this point, the project is imported IntelliJ idea.
Configuring JDPA Remote Debugging
From 5.3 onwards, SOLR no longer provides war packages. The SOLR team said: "SOLR is intended-be-a server not a Java Web application". Therefore, under the \LUCENE-SOLR\SOLR directory, run Ant server to create the SOLR server. The default root directory for SOLR's cores is \LUCENE-SOLR\SOLR\SERVER\SOLR.
Then, in idea, configure remote debugging. In "Run configurations" add remote, in the configuration, custom Name,host, and port. Transport Select the socket option.
Next, we go into the Lucene-solr\solr\bin folder in cmd and run SOLR start-p 8988-f-a "-xdebug-xrunjdwp:transport=dt_socket,server=y, suspend=y,address=8988 ", the configured port number (e.g. 8988) be consistent with the port number configured in idea.
Finally, run debug mode in idea. We can start debugging by http://localhost:8988 in the Web page.
View SOLR log files in IntelliJ idea
To make it easier to view SOLR log files, you can view the logs in idea in the following configuration.
Add the \lucene-solr\solr\server\logs\solr.log file in debug configurations.
Modify the \lucene-solr\solr\server\resources\log4j.properties file to customize the contents of the log output. When debugging remotely, the log shown in idea is as follows:
Using IntelliJ idea to build SOLR debugging environment