Which loggers does Elasticsearch have?

The doc says:

Messages are logged by a hierarchy of loggers which matches the hierarchy of Java packages and classes in the Elasticsearch source code.

And it gives an example:

logger.org.elasticsearch.discovery: DEBUG

Is there a list of all available loggers? Can I set the level of all of them, instead one line for each?

Also from the same docs:

By default Elasticsearch includes all messages at levels INFO , WARN , ERROR and FATAL in its logs, but filters out messages at levels DEBUG and TRACE . This is the recommended configuration. Do not filter out messages at INFO or higher log levels or else you may not be able to understand your cluster’s behaviour or troubleshoot common problems. Do not enable logging at levels DEBUG or TRACE unless you are following instructions elsewhere in this manual which call for more detailed logging, or you are an expert user who will be reading the Elasticsearch source code to determine the meaning of the logs.

So technically (if somewhat unhelpfully) the answer is yes, there is a list of loggers: the source code. If you're not ok with reading the source code, it probably won't be very useful to adjust any loggers other than the ones mentioned in the manual.

Maybe let's turn this around: are you trying to troubleshoot something but struggling because of insufficient detail in the logs? If so, that might be a bug. Can we help you with the troubleshooting here so we can understand what we can do to improve the default logs to the point where you don't feel the need to adjust anything?

I posted this post because of two reasons:

  1. I'm curious how many loggers Elasticsearch can have.
  2. I do want to decrease the overall log level to WARN to filter out some unnecessary info, although the doc says one should keep it to INFO.

In main, a rough approximation would be about 1500.

$ git grep 'LogManager.getLogger' | wc -l
    1521

It's ultimately up to you, but we do recommend not doing this. How would a list of all the loggers help with this?

I was curious when I read the doc, so I wanted to know how many loggers Elasticsearch has. It has nothing to do with decrease the overall log level to WARN. For that, is it possible to write only one line in elasticsearch.yml?

ChatGPT says:

# Set the logging level for all Elasticsearch loggers to WARN  
logger.org.elasticsearch.level = WARN

But I haven't found this mentioned in doc.

Well yeah that's because ChatGPT's claim is not true.

Pretty much all of the loggers in Elasticsearch are under org.elasticsearch so you can set that logger to WARN using the methods described in the manual.

1 Like

Thank you. But I still think it's strange that there is no way to modify the log level of all 1500+ loggers in one line...

1 Like