Changing logging settings

Standard logging settings work very well for general usage.

Changing the log level can be useful to check for bugs or understanding malfunctions due to bad configuration or strange plugin behaviors. A verbose log can be used from Elasticsearch community to cover problems.

If you need to debug your Elasticsearch server or change how the logging works (that is, remoting send events), you need to change the log4j2.properties parameters.

Getting ready

You need a working Elasticsearch installation as we described in the Downloading and installing Elasticsearch recipe and a simple text editor to change configuration files.

How to do it...

In the config directory in your Elasticsearch install directory, there is a log4j2.properties file, which controls the working settings.

The steps required for changing the logging settings are:

  1. To emit every kind of logging Elasticsearch has, you can change the current root level logging which is:
            rootLogger.level = info 
    
  2. This needs to be changed to the following:
            rootLogger.level = debug 
    
  3. Now, if you start Elasticsearch from command-line (with bin/elasticsearch -f), you should see a lot of garbage:
           [2017-01-11T21:34:16,369][DEBUG][o.e.b.Seccomp] BSD RLIMIT_NPROC
           initialization successful[2017-01-11T21:34:16,377][DEBUG]  
           [o.e.b.Seccomp] OS X seatbelt initialization successful 
           [2017-01-11T21:34:16,404][DEBUG][o.e.b.JarHell] 
           java.class.path:   
           /usr/local/Cellar/elasticsearch/5.1.1/libexec/lib/elasticsearch-   
           5.1.1.jar:/usr/local/Cellar/elasticsearch/5.1.1/libexec/lib
           /elasticsearch5.1.1.jar:/usr/local/Cellar/elasticsearch/5.1.1/
           libexec/lib/HdrHistogram2.1.6.jar:/usr/local/Cellar/
           elasticsearch/5.1.1/libexec/lib/hppc-0.7.1.jar:/usr
           /local/Cellar/
           ... (truncated)... 
    

How it works...

Elasticsearch logging system is based on the log4j library (http://logging.apache.org/log4j/).

Log4j is a powerful library to manage logging, covering all of its functionalities is outside the scope of this book. If a user needs advanced usage, there are a lot of books and articles on the Internet about it.

..................Content has been hidden....................

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