Skip to content

Commit d768757

Browse files
committed
logger: alter loglevel behavior
1 parent 6b32199 commit d768757

File tree

5 files changed

+409
-444
lines changed

5 files changed

+409
-444
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ additional details on each available environment variable.
133133
| `AWS_SECRET_ACCESS_KEY` | EXAMPLEKEY | The [secret key](http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html) used by the agent for all calls. | Taken from Amazon EC2 instance metadata. | Taken from Amazon EC2 instance metadata. |
134134
| `AWS_SESSION_TOKEN` | | The [session token](http://docs.aws.amazon.com/STS/latest/UsingSTS/Welcome.html) used for temporary credentials. | Taken from Amazon EC2 instance metadata. | Taken from Amazon EC2 instance metadata. |
135135
| `DOCKER_HOST` | `unix:///var/run/docker.sock` | Used to create a connection to the Docker daemon; behaves similarly to this environment variable as used by the Docker client. | `unix:///var/run/docker.sock` | `npipe:////./pipe/docker_engine` |
136-
| `ECS_LOGLEVEL` | <crit> | <error> | <warn> | <info> | <debug> | The level of detail that should be logged by the logging driver, or on Windows, the Windows Event Log. | info | info |
137-
| `ECS_LOGLEVEL_ON_INSTANCE` | <none> | <crit> | <error> | <warn> | <info> | <debug> | The level of detail that should be logged in the on-instance log file. | none if `ECS_LOG_DRIVER` is explicitly set to a non-empty value; info otherwise | none if `ECS_LOG_DRIVER` is explicitly set to a non-empty value; info otherwise |
136+
| `ECS_LOGLEVEL` | <crit> | <error> | <warn> | <info> | <debug> | The level of detail to be logged. | info | info |
137+
| `ECS_LOGLEVEL_ON_INSTANCE` | <none> | <crit> | <error> | <warn> | <info> | <debug> | Can be used to override `ECS_LOGLEVEL` and set a level of detail that should be logged in the on-instance log file, separate from the level that is logged in the logging driver. If a logging driver is explicitly set, on-instance logs are turned off by default, but can be turned back on with this variable. | none if `ECS_LOG_DRIVER` is explicitly set to a non-empty value; otherwise the same value as `ECS_LOGLEVEL` | none if `ECS_LOG_DRIVER` is explicitly set to a non-empty value; otherwise the same value as `ECS_LOGLEVEL` |
138138
| `ECS_LOGFILE` | /ecs-agent.log | The location where logs should be written. Log level is controlled by `ECS_LOGLEVEL`. | blank | blank |
139139
| `ECS_CHECKPOINT` | <true | false> | Whether to checkpoint state to the DATADIR specified below. | true if `ECS_DATADIR` is explicitly set to a non-empty value; false otherwise | true if `ECS_DATADIR` is explicitly set to a non-empty value; false otherwise |
140140
| `ECS_DATADIR` | /data/ | The container path where state is checkpointed for use across agent restarts. Note that on Linux, when you specify this, you will need to make sure that the Agent container has a bind mount of `$ECS_HOST_DATA_DIR/data:$ECS_DATADIR` with the corresponding values of `ECS_HOST_DATA_DIR` and `ECS_DATADIR`. | /data/ | `C:\ProgramData\Amazon\ECS\data`

agent/logger/log.go

+3
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ func setInstanceLevelDefault() string {
163163
if logDriver := os.Getenv(LOG_DRIVER_ENV_VAR); logDriver != "" {
164164
return DEFAULT_LOGLEVEL_WHEN_DRIVER_SET
165165
}
166+
if loglevel := os.Getenv(LOGLEVEL_ENV_VAR); loglevel != "" {
167+
return loglevel
168+
}
166169
return DEFAULT_LOGLEVEL
167170
}
168171

0 commit comments

Comments
 (0)