Skip to content
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

logger: change loglevel behavior #2597

Merged
merged 1 commit into from
Sep 2, 2020
Merged

logger: change loglevel behavior #2597

merged 1 commit into from
Sep 2, 2020

Conversation

tamor1
Copy link
Contributor

@tamor1 tamor1 commented Aug 28, 2020

Summary

Changes behavior of ECS_LOGLEVEL to control the level of logging for both the logging driver and the on instance file unless ECS_LOGLEVEL_ON_INSTANCE is set to override it. ECS_LOGLEVEL_ON_INSTANCE defaults to off if a logging driver is set, or it defaults to the value of ECS_LOGLEVEL if not.

Implementation details

The behavior for interactions between ECS_LOG_DRIVER, ECS_LOGLEVEL, and ECS_LOGLEVEL_ON_INSTANCE is as follows (default level is info):

Set LOGLEVEL: driver level = ECS_LOGLEVEL, instance level = ECS_LOGLEVEL
Set LOGLEVEL_ON_INSTANCE: driver = default, instance = LOGLEVEL_ON_INSTANCE
Set both: driver = ECS_LOGLEVEL, instance = LOGLEVEL_ON_INSTANCE

Set LOGLEVEL + LOG_DRIVER: driver = ECS_LOGLEVEL, instance = off
Set LOGLEVEL_ON_INSTANCE + LOG_DRIVER: driver ; default, instance = LOGLEVEL_ON_INSTANCE
Set Both + Driver: driver: LOGLEVEL, instance: LOGLEVEL_ON_INSTANCE

Set just LOG_DRIVER: driver = default, instance = off
Set none of them: driver = default, instance = default

Testing

Added a unit test to test the interactions between the variables above and manually tested all combinations by setting the variables and checking the logs.

Description for the changelog

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

agent/logger/log_test.go Outdated Show resolved Hide resolved
agent/logger/log_windows_test.go Outdated Show resolved Hide resolved
agent/logger/log_test.go Show resolved Hide resolved
agent/logger/log_test.go Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants