You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/container-apps/java-dynamic-log-level.md
+16-14Lines changed: 16 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,37 +22,39 @@ To take advantage of these diagnostic tools, you can create a new container app
22
22
To create a new container app with JVM diagnostics enabled, use the following command:
23
23
24
24
```azurecli
25
-
// TODO: replace this
26
-
az containerapp java diagnostics enable --enable-java-agent \
25
+
az containerapp create --enable-java-agent \
27
26
--environment <ENVIRONMENT_NAME> \
28
27
--resource-group <RESOURCE_GROUP> \
29
-
--name <JAVA_COMPONENT_NAME>
28
+
--name <CONTAINER_APP_NAME>
30
29
```
31
30
32
31
To update an existing container app, use the following command:
33
32
34
33
```azurecli
35
-
// TODO: replace this
36
-
az containerapp create --enable-java-agent \
34
+
az containerapp update --enable-java-agent \
37
35
--environment <ENVIRONMENT_NAME> \
38
36
--resource-group <RESOURCE_GROUP> \
39
-
--name <JAVA_COMPONENT_NAME>
37
+
--name <CONTAINER_APP_NAME>
40
38
```
41
39
42
40
## Change runtime logger levels
43
41
44
-
After enabling JVM diagnostics, you can change runtime logger levels without interrupting your running apps.
45
-
46
-
Use the following command to adjust the logger levels in your Java application.
47
-
42
+
After enabling JVM diagnostics, you can change runtime log levels for specific loggers in your running Java app without the need to restart it.
43
+
44
+
Use the following command to adjust log levels for a specific logger:
45
+
48
46
```azurecli
49
-
// TODO: replace this
50
-
az containerapp env java-component list \
47
+
az containerapp java logger update \
48
+
--logger-name "org.springframework.boot" \
49
+
--level "info"
51
50
--environment <ENVIRONMENT_NAME> \
52
-
--resource-group <RESOURCE_GROUP>
51
+
--resource-group <RESOURCE_GROUP> \
52
+
--name <CONTAINER_APP_NAME>
53
53
```
54
+
55
+
In this sample logger name is `"org.springframework.boot"` and desired log level is `"info"`. Change these to your own logger name and log level to help troubleshoot your Java app.
54
56
55
-
It could take up to two minutes for the logger level change to take effect. Once complete, you can check the application logs from [log streams](log-streaming.md) or other [log options](log-options.md).
57
+
It may take up to two minutes for the logger level change to take effect. Once complete, you can check the application logs from [log streams](log-streaming.md) or other [log options](log-options.md).
0 commit comments