You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ElasticSearch uses logger names like "node", "plugins", "discovery" etc. and there are a lot of loggers. When it is run as a standalone server, there won't be problem as all the code are supposed to be ElasticSearch code.
However, when ES is used in a separated Java application as client, the logger mess up with my application's log. I use log4j.xml and I have to add a log of custom loggers entries because ES's ain't under its own package.
My suggestion:
I suppose your objective is to make the server log easier to read. I suggest to use full class name as logger name, and provide a default log4j layout pattern that doesn't show the full class name. Log4j's pattern is quite flexible. http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html
For example, for the category name "a.b.c" the pattern %c{2} will output "b.c".
For the majority of cases, %c{1} should work. Except some cases such as "cluster.service" that %c{1} won't show a meaningful logger name.
a workaround is to use a System property to define a prefix for the logger. So when ES is run in a client environment, we can set a property like -Des.logger.prefix=com.elasticsearch. and then we can use a single log4j category to capture all the logs.
The text was updated successfully, but these errors were encountered:
ElasticSearch uses logger names like "node", "plugins", "discovery" etc. and there are a lot of loggers. When it is run as a standalone server, there won't be problem as all the code are supposed to be ElasticSearch code.
However, when ES is used in a separated Java application as client, the logger mess up with my application's log. I use log4j.xml and I have to add a log of custom loggers entries because ES's ain't under its own package.
My suggestion:
http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/PatternLayout.html
For example, for the category name "a.b.c" the pattern %c{2} will output "b.c".
For the majority of cases, %c{1} should work. Except some cases such as "cluster.service" that %c{1} won't show a meaningful logger name.
The text was updated successfully, but these errors were encountered: