Logging

Logs are a way to know what's going in the system at any point in time. When you click on logging, a screen similar to the following screenshot comes up. This is the interface where real-time logs of Solr are shown. It even supports multi-core logs. You can see various log levels, time, message, the core from which it comes, and so on:

Here are a few highlights of the logging details of our out-of-the-box Solr example:

  • It shows logs based on time, level, core, logger class, and message.
  • Some of the messages have an informative icon at the end. Clicking on it prints the stack trace.
  • There are different log levels. The red ones are error level logs, and the yellow ones are warning level logs.

Solr provides a way to change the log level at any running system instance. You can adjust the level of logs for any class. The various options for the log level you can select are all, trace, debug, info, warn, error, fatal, off, and unset.

You can change the log levels of any class at any point of the running instance.

When you open up the level in Solr, you will see all of the hierarchy of class paths and class names. Any class that has logging capabilities would be marked in yellow. Click on the highlighted row and you will be able to change the log level of that class.

One interesting parameter you will see is unset. Any category that is unset will have log levels of its parents. This simple feature allows us to change many categories at once by just changing the log level of the parent:

This is a runtime setting and is not persisted, so if you open Solr again, it will be lost.

This isn't the only way we can change the log levels. Log levels can also be changed in the following ways:

  • Using the log level API as mentioned here:
# Set the root logger to level WARN curl -s http://localhost:8983/solr/admin/info/logging --data-binary "set=root:WARN"
  • Log levels can also be selected at startup. Again, this can be done in two ways:
    • Search for the string SOLR_LOGS_LEVEL in bin/solr.in.cmd or binsolr.in.sh. Change it as needed.
    • The second alternative is to pass at startup with the -v or -q options. For example:
binsolr start -f -v
binsolr start -f -q
  • A more permanent solution can be to change log4j.properties directly, which can be found at $solr_home/server/resources.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.190.18