Solr
  1. Solr
  2. SOLR-4760

Improve logging messages during startup to better identify core

    Details

    • Type: Wish Wish
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 4.3
    • Fix Version/s: 4.3.1, 4.4, 5.0
    • Component/s: Schema and Analysis
    • Labels:
      None

      Description

      Some log messages could be more informative. For example:

      680 [coreLoadExecutor-3-thread-3] WARN org.apache.solr.schema.IndexSchema  – schema has no name!
      

      Would be very nice to know which core this is complaining about.
      Later, once the core is loaded, the core name shows up in the logs,
      but it would be nice to have it earlier without having to
      triangulating it through 'Loading core' messages.

      1. SOLR-4760.patch
        2 kB
        Shawn Heisey
      2. SOLR-4760.patch
        2 kB
        Shawn Heisey
      3. SOLR-4760-testfix.patch
        1.0 kB
        Erick Erickson

        Activity

        Hide
        Shawn Heisey added a comment - - edited

        Patch to include the core name when loading the schema, whether the schema name is found or not. Verified that it works.

        Is this approach the right way to go, or should I be getting the core name in a different way? I suppose a StringBuilder is slightly overkill for the log message.

        Show
        Shawn Heisey added a comment - - edited Patch to include the core name when loading the schema, whether the schema name is found or not. Verified that it works. Is this approach the right way to go, or should I be getting the core name in a different way? I suppose a StringBuilder is slightly overkill for the log message.
        Hide
        Alexandre Rafalovitch added a comment -

        If 4.3.1 is coming out soon, can this patch make it in? What needs to be done (testing)?

        Show
        Alexandre Rafalovitch added a comment - If 4.3.1 is coming out soon, can this patch make it in? What needs to be done (testing)?
        Hide
        Shawn Heisey added a comment -

        Alexandre Rafalovitch I will be committing this change this evening or tomorrow to 4.3.1, 4.4, and 5.0.

        Show
        Shawn Heisey added a comment - Alexandre Rafalovitch I will be committing this change this evening or tomorrow to 4.3.1, 4.4, and 5.0.
        Hide
        Shawn Heisey added a comment -

        Updated patch for trunk that puts the CHANGES.txt entry in the 4.3.1 section.

        Show
        Shawn Heisey added a comment - Updated patch for trunk that puts the CHANGES.txt entry in the 4.3.1 section.
        Hide
        Commit Tag Bot added a comment -

        [trunk commit] elyograg
        http://svn.apache.org/viewvc?view=revision&revision=1480882

        SOLR-4760: Include core name in logs when loading schema.

        Show
        Commit Tag Bot added a comment - [trunk commit] elyograg http://svn.apache.org/viewvc?view=revision&revision=1480882 SOLR-4760 : Include core name in logs when loading schema.
        Hide
        Commit Tag Bot added a comment -

        [branch_4x commit] elyograg
        http://svn.apache.org/viewvc?view=revision&revision=1480886

        SOLR-4760: Include core name in logs when loading schema. (merge trunk r1480882)

        Show
        Commit Tag Bot added a comment - [branch_4x commit] elyograg http://svn.apache.org/viewvc?view=revision&revision=1480886 SOLR-4760 : Include core name in logs when loading schema. (merge trunk r1480882)
        Hide
        Commit Tag Bot added a comment -

        [lucene_solr_4_3 commit] elyograg
        http://svn.apache.org/viewvc?view=revision&revision=1480893

        SOLR-4760: Include core name in logs when loading schema. (merge trunk r1480882)

        Show
        Commit Tag Bot added a comment - [lucene_solr_4_3 commit] elyograg http://svn.apache.org/viewvc?view=revision&revision=1480893 SOLR-4760 : Include core name in logs when loading schema. (merge trunk r1480882)
        Hide
        Jan Høydahl added a comment -

        I get a nullpointer caused by this patch, when running tests for a patch.

        [junit4:junit4]   2> NOTE: All tests run in this JVM: [TestMaxScoreQueryParser]
        [junit4:junit4]   2> NOTE: reproduce with: ant test  -Dtestcase=TestMaxScoreQueryParser -Dtests.seed=FFA2D62653D3F0F3 -Dtests.slow=true -Dtests.locale=nl_BE -Dtests.timezone=America/Shiprock -Dtests.file.encoding=UTF-8
        [junit4:junit4] ERROR   0.00s | TestMaxScoreQueryParser (suite) <<<
        [junit4:junit4]    > Throwable #1: org.apache.solr.common.SolrException: Schema Parsing Failed: null
        [junit4:junit4]    > 	at __randomizedtesting.SeedInfo.seed([FFA2D62653D3F0F3]:0)
        [junit4:junit4]    > 	at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:607)
        [junit4:junit4]    > 	at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:166)
        [junit4:junit4]    > 	at org.apache.solr.schema.IndexSchemaFactory.create(IndexSchemaFactory.java:55)
        [junit4:junit4]    > 	at org.apache.solr.schema.IndexSchemaFactory.buildIndexSchema(IndexSchemaFactory.java:69)
        [junit4:junit4]    > 	at org.apache.solr.util.TestHarness.<init>(TestHarness.java:108)
        [junit4:junit4]    > 	at org.apache.solr.SolrTestCaseJ4.createCore(SolrTestCaseJ4.java:393)
        [junit4:junit4]    > 	at org.apache.solr.SolrTestCaseJ4.initCore(SolrTestCaseJ4.java:385)
        [junit4:junit4]    > 	at org.apache.solr.SolrTestCaseJ4.initCore(SolrTestCaseJ4.java:197)
        [junit4:junit4]    > 	at org.apache.solr.SolrTestCaseJ4.initCore(SolrTestCaseJ4.java:184)
        [junit4:junit4]    > 	at org.apache.solr.search.TestMaxScoreQueryParser.beforeClass(TestMaxScoreQueryParser.java:36)
        [junit4:junit4]    > 	at java.lang.Thread.run(Thread.java:722)
        [junit4:junit4]    > Caused by: java.lang.NullPointerException
        [junit4:junit4]    > 	at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:437)
        [junit4:junit4]    > 	... 32 more
        [junit4:junit4] Completed in 2.16s, 0 tests, 1 error <<< FAILURES!
        

        The offending line is:

        437:      sb.append(loader.getCoreProperties().getProperty(NAME));
        
        Show
        Jan Høydahl added a comment - I get a nullpointer caused by this patch, when running tests for a patch. [junit4:junit4] 2> NOTE: All tests run in this JVM: [TestMaxScoreQueryParser] [junit4:junit4] 2> NOTE: reproduce with: ant test -Dtestcase=TestMaxScoreQueryParser -Dtests.seed=FFA2D62653D3F0F3 -Dtests.slow=true -Dtests.locale=nl_BE -Dtests.timezone=America/Shiprock -Dtests.file.encoding=UTF-8 [junit4:junit4] ERROR 0.00s | TestMaxScoreQueryParser (suite) <<< [junit4:junit4] > Throwable #1: org.apache.solr.common.SolrException: Schema Parsing Failed: null [junit4:junit4] > at __randomizedtesting.SeedInfo.seed([FFA2D62653D3F0F3]:0) [junit4:junit4] > at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:607) [junit4:junit4] > at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:166) [junit4:junit4] > at org.apache.solr.schema.IndexSchemaFactory.create(IndexSchemaFactory.java:55) [junit4:junit4] > at org.apache.solr.schema.IndexSchemaFactory.buildIndexSchema(IndexSchemaFactory.java:69) [junit4:junit4] > at org.apache.solr.util.TestHarness.<init>(TestHarness.java:108) [junit4:junit4] > at org.apache.solr.SolrTestCaseJ4.createCore(SolrTestCaseJ4.java:393) [junit4:junit4] > at org.apache.solr.SolrTestCaseJ4.initCore(SolrTestCaseJ4.java:385) [junit4:junit4] > at org.apache.solr.SolrTestCaseJ4.initCore(SolrTestCaseJ4.java:197) [junit4:junit4] > at org.apache.solr.SolrTestCaseJ4.initCore(SolrTestCaseJ4.java:184) [junit4:junit4] > at org.apache.solr.search.TestMaxScoreQueryParser.beforeClass(TestMaxScoreQueryParser.java:36) [junit4:junit4] > at java.lang.Thread.run(Thread.java:722) [junit4:junit4] > Caused by: java.lang.NullPointerException [junit4:junit4] > at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:437) [junit4:junit4] > ... 32 more [junit4:junit4] Completed in 2.16s, 0 tests, 1 error <<< FAILURES! The offending line is: 437: sb.append(loader.getCoreProperties().getProperty(NAME));
        Hide
        Jan Høydahl added a comment -

        Reopening to examine the nullpointer

        Show
        Jan Høydahl added a comment - Reopening to examine the nullpointer
        Hide
        Erick Erickson added a comment -

        right, I'm seeing the same thing:
        sb.append(loader.getCoreProperties().getProperty(NAME));
        getCoreProperties returns null here. Seems like a simple if test here would suffice, are you taking care of it or should I? I've seen several situations where stuff is null (particularly CoreContainer.cfg) in the test environment that are never null in non-test, this could be another one of those.

        Show
        Erick Erickson added a comment - right, I'm seeing the same thing: sb.append(loader.getCoreProperties().getProperty(NAME)); getCoreProperties returns null here. Seems like a simple if test here would suffice, are you taking care of it or should I? I've seen several situations where stuff is null (particularly CoreContainer.cfg) in the test environment that are never null in non-test, this could be another one of those.
        Hide
        Jan Høydahl added a comment -

        Yea, a test issue probably. Not sure why I bump into it only in the tests.

        I tried to copy core.properties into collection1/ in test-files, but that did not help either. Must be that test framework does not initialize same way as the real thing.

        Show
        Jan Høydahl added a comment - Yea, a test issue probably. Not sure why I bump into it only in the tests. I tried to copy core.properties into collection1/ in test-files, but that did not help either. Must be that test framework does not initialize same way as the real thing.
        Hide
        Jan Høydahl added a comment -

        This patch did the trick for me

        437:      sb.append(loader.getCoreProperties()!=null ? loader.getCoreProperties().getProperty(NAME) : "(N/A)");
        
        Show
        Jan Høydahl added a comment - This patch did the trick for me 437: sb.append(loader.getCoreProperties()!= null ? loader.getCoreProperties().getProperty(NAME) : "(N/A)" );
        Hide
        Erick Erickson added a comment -

        yep, that's what I've found viz. some of the stuff in CoreContainer, you'll see some if tests in there (which I hate but haven't had a chance to track down).

        I'll take care of it. I think this is useful information in the usual case, simple if test. Look for a patch soon.

        Show
        Erick Erickson added a comment - yep, that's what I've found viz. some of the stuff in CoreContainer, you'll see some if tests in there (which I hate but haven't had a chance to track down). I'll take care of it. I think this is useful information in the usual case, simple if test. Look for a patch soon.
        Hide
        Commit Tag Bot added a comment -
        Show
        Commit Tag Bot added a comment - [trunk commit] erick http://svn.apache.org/viewvc?view=revision&revision=1480998 Test fix for SOLR-4760
        Hide
        Commit Tag Bot added a comment -
        Show
        Commit Tag Bot added a comment - [branch_4x commit] erick http://svn.apache.org/viewvc?view=revision&revision=1481003 Test fix for SOLR-4760
        Hide
        Erick Erickson added a comment -

        trunk: r - 1480998
        4x: r - 1481003

        Show
        Erick Erickson added a comment - trunk: r - 1480998 4x: r - 1481003
        Hide
        Erick Erickson added a comment -

        Patch for making the tests run, apply on top of original patch.

        Show
        Erick Erickson added a comment - Patch for making the tests run, apply on top of original patch.
        Hide
        Erick Erickson added a comment -

        Added null test so this doesn't break the tests.

        Show
        Erick Erickson added a comment - Added null test so this doesn't break the tests.
        Hide
        Erick Erickson added a comment -

        Gaaah. Removed the trailing ']' in the message by mistake. I'm not going to re-spin the test-fix patch, but I'll fix it in another patch I'll put up shortly.

        Show
        Erick Erickson added a comment - Gaaah. Removed the trailing ']' in the message by mistake. I'm not going to re-spin the test-fix patch, but I'll fix it in another patch I'll put up shortly.
        Hide
        Shawn Heisey added a comment -

        Jan Høydahl and Erick Erickson, many thanks for finding and fixing my mistake while I slept. I did run tests and precommit back when I created this patch, but I did not do so before the actual commit, which was sloppy.

        Show
        Shawn Heisey added a comment - Jan Høydahl and Erick Erickson , many thanks for finding and fixing my mistake while I slept. I did run tests and precommit back when I created this patch, but I did not do so before the actual commit, which was sloppy.
        Hide
        Commit Tag Bot added a comment -

        [lucene_solr_4_3 commit] erick
        http://svn.apache.org/viewvc?view=revision&revision=1481022

        backporting test fix for SOLR-4760 to 4.3.1

        Show
        Commit Tag Bot added a comment - [lucene_solr_4_3 commit] erick http://svn.apache.org/viewvc?view=revision&revision=1481022 backporting test fix for SOLR-4760 to 4.3.1
        Hide
        Erick Erickson added a comment -

        backported to 4.3.1, r: 1481022

        Show
        Erick Erickson added a comment - backported to 4.3.1, r: 1481022
        Hide
        Shawn Heisey added a comment -

        Erick has a lot to do before leaving on vacation, so I'll finish cleaning up my own mess. The bracket was re-added via trunk r1481079 and branch_4x r1481111, but it has a minor typo. I will fix that in trunk and backport to 4.x. The fix for 4.3.1 will not be a backport since Erick's change wasn't included there.

        Show
        Shawn Heisey added a comment - Erick has a lot to do before leaving on vacation, so I'll finish cleaning up my own mess. The bracket was re-added via trunk r1481079 and branch_4x r1481111, but it has a minor typo. I will fix that in trunk and backport to 4.x. The fix for 4.3.1 will not be a backport since Erick's change wasn't included there.
        Hide
        Commit Tag Bot added a comment -

        [trunk commit] elyograg
        http://svn.apache.org/viewvc?view=revision&revision=1481129

        SOLR-4760: fix typo in re-added bracket

        Show
        Commit Tag Bot added a comment - [trunk commit] elyograg http://svn.apache.org/viewvc?view=revision&revision=1481129 SOLR-4760 : fix typo in re-added bracket
        Hide
        Commit Tag Bot added a comment -

        [branch_4x commit] elyograg
        http://svn.apache.org/viewvc?view=revision&revision=1481130

        SOLR-4760: fix typo in re-added bracket (merge trunk r1481129)

        Show
        Commit Tag Bot added a comment - [branch_4x commit] elyograg http://svn.apache.org/viewvc?view=revision&revision=1481130 SOLR-4760 : fix typo in re-added bracket (merge trunk r1481129)
        Hide
        Commit Tag Bot added a comment -

        [lucene_solr_4_3 commit] elyograg
        http://svn.apache.org/viewvc?view=revision&revision=1481131

        SOLR-4760: re-add bracket

        Show
        Commit Tag Bot added a comment - [lucene_solr_4_3 commit] elyograg http://svn.apache.org/viewvc?view=revision&revision=1481131 SOLR-4760 : re-add bracket
        Hide
        Shalin Shekhar Mangar added a comment -

        Bulk close after 4.3.1 release

        Show
        Shalin Shekhar Mangar added a comment - Bulk close after 4.3.1 release
        Hide
        Alexandre Rafalovitch added a comment -

        Has this actually made it into 4.3.1? Because I am not seeing any difference:

        [coreLoadExecutor-3-thread-1] INFO org.apache.solr.core.SolrResourceLoader – Adding 'file:/Users/arafalov/SOLR/solr-4.3.1/contrib/analysis-extras/lucene-libs/lucene-analyzers-morfologik-4.3.1.jar' to classloader
        [coreLoadExecutor-3-thread-2] INFO org.apache.solr.schema.IndexSchema – unique key field: id

        Show
        Alexandre Rafalovitch added a comment - Has this actually made it into 4.3.1? Because I am not seeing any difference: [coreLoadExecutor-3-thread-1] INFO org.apache.solr.core.SolrResourceLoader – Adding 'file:/Users/arafalov/SOLR/solr-4.3.1/contrib/analysis-extras/lucene-libs/lucene-analyzers-morfologik-4.3.1.jar' to classloader [coreLoadExecutor-3-thread-2] INFO org.apache.solr.schema.IndexSchema – unique key field: id
        Hide
        Shawn Heisey added a comment -

        Alexandre Rafalovitch It did make it into 4.3.1, but it only affected the error message about the schema not having a name. The message you are seeing (about the unique key field) wasn't changed. If you want to file a new issue, I will take another look when I have time.

        Show
        Shawn Heisey added a comment - Alexandre Rafalovitch It did make it into 4.3.1, but it only affected the error message about the schema not having a name. The message you are seeing (about the unique key field) wasn't changed. If you want to file a new issue, I will take another look when I have time.

          People

          • Assignee:
            Shawn Heisey
            Reporter:
            Alexandre Rafalovitch
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development