JaredTan95 commented on a change in pull request #1957: feat:Active System.env
Config In Both Collector And agent.config.
URL:
https://github.com/apache/incubator-skywalking/pull/1957#discussion_r236073308
##########
File path: docs/en/setup/service-agent/java-agent/Setting-override.md
##########
@@ -43,7 +43,27 @@ Add the properties after the agent path in JVM arguments.
-javaagent:/path/to/skywalking-agent.jar=agent.ignore_suffix='.jpg,.jpeg'
```
+## System environment variables
+- Example
+
+ Override `agent.application_code` and `logging.level` by this.
+
+```
+# The service name in UI
+agent.service_name=${SW_AGENT_NAME:Your_ApplicationName}
+
+# Logging level
+logging.level=${SW_LOGGING_LEVEL:INFO}
+```
+
+If the `SW_AGENT_NAME ` environment variable exists in your operating system
and its value is `skywalking-agent-demo`,
+then the value of `agent.service_name` here will be overwritten to
`skywalking-agent-demo`, otherwise, it will be set to `Your_ApplicationName`.
+
+By the way, Placeholder nesting is also supported, like
`${SW_AGENT_NAME:${ANOTHER_AGENT_NAME:Your_ApplicationName}}`.
+In this case, if the `SW_AGENT_NAME ` environment variable not exists, but the
```ANOTHER_AGENT_NAME```
+environment variable exists and its value is `skywalking-agent-demo`, then the
value of `agent.service_name` here will be overwritten to
`skywalking-agent-demo`,otherwise, it will be set to `Your_ApplicationName`.
+
Review comment:
Yes, it should be more friendly to developers.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services