Skip to content

Plugin cli tool should not create empty log files#13933

Merged
brwe merged 1 commit intoelastic:masterfrom
brwe:plugin-cli-logging
Oct 6, 2015
Merged

Plugin cli tool should not create empty log files#13933
brwe merged 1 commit intoelastic:masterfrom
brwe:plugin-cli-logging

Conversation

@brwe
Copy link
Copy Markdown
Contributor

@brwe brwe commented Oct 5, 2015

Plugin cli tools configures logging with whatever is in the logging.yml.
If a file appender is configured for any of the logs this will cause creation
of an empty log file. If a plugin was for example installed as root it will
create empty logs at es.home/logs.
This is problematic when for example plugins are installed as root and es is run
as service. Logs will then be created in /usr/share/elasticsearch/logs
and can later not be removed by for example dpkg -r or -purge.

To avoid this, configure the logger to use an appender that writes to the same
output that plugin cli tool does. This allows other components that are called
from Plugin cli tool to write to the same terminal that plugin cli tool writes to
by using the logging mechanism already in place.
The logging conf is not read at all pb plugin cli tool.

As a side effect, the loging level for components that are called
from the plugin command such as the jar hell check can now be configured
with -Des.logger.level which makes it easier to debug the jar hell check.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System.getProperty("es.logger.level", "INFO");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably deserves javadoc saying that resolveConfig controls if the config file is read or not.

@spinscale
Copy link
Copy Markdown
Contributor

left some minor comments, agreeing with the others, but this looks good. thx for digging!

@brwe brwe force-pushed the plugin-cli-logging branch from e0975b1 to 0317de1 Compare October 5, 2015 15:14
@brwe
Copy link
Copy Markdown
Contributor Author

brwe commented Oct 5, 2015

@dadoonet @nik9000 @spinscale thanks a lot for the review! I addressed all comments.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for writing this. Wonderful.

@nik9000
Copy link
Copy Markdown
Member

nik9000 commented Oct 5, 2015

LGTM

@brwe brwe force-pushed the plugin-cli-logging branch from 208e748 to 3e4976d Compare October 6, 2015 11:50
Plugin cli tools configures logging with whatever is in the logging.yml.
If a file appender is configured for any of the logs this will cause creation
of an empty log file. If a plugin was for example installed as root it will
create empty logs at es.home/logs.
This is problematic when for example plugins are installed as root and es is run
as service. Logs will then be created in /usr/share/elasticsearch/logs
and can later not be removed by for example dpkg -r or -purge.

To avoid this, configure the logger to use an appender that writes to the same
output that plugin cli tool does. This allows other components that are called
from Plugin cli tool to write to the same terminal that plugin cli tool writes to
by using the logging mechanism already in place.
The logging conf is not read at all pb plugin cli tool.

As a side effect, the loging level for components that are called
from the plugin command such as the jar hell check can now be configured
with -Des.logger.level which makes it easier to debug the jar hell check.
@brwe brwe force-pushed the plugin-cli-logging branch from 3e4976d to 9492be6 Compare October 6, 2015 12:13
brwe added a commit that referenced this pull request Oct 6, 2015
plugin cli tool should not create empty log files
@brwe brwe merged commit d2ca694 into elastic:master Oct 6, 2015
@clintongormley clintongormley changed the title plugin cli tool should not create empty log files Plugin cli tool should not create empty log files Oct 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>bug :Core/Infra/Logging Log management and logging utilities v2.0.0 v2.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants