New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to configure a common logger prefix using `es.logger.prefix` system prop #360

Closed
mingfai opened this Issue Sep 7, 2010 · 2 comments

Comments

Projects
None yet
2 participants
@mingfai

mingfai commented Sep 7, 2010

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:

  1. 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.

  1. 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.
@kimchy

This comment has been minimized.

Member

kimchy commented Sep 8, 2010

Agreed, I will add a system property to allow to define a common logger prefix named -Des.logger.prefix.

@kimchy

This comment has been minimized.

Member

kimchy commented Sep 8, 2010

Allow to configure a common logger prefix using es.logger.prefix system prop, closed by a768016.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment