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
While developing and troubleshooting your container app, it's important to see a container's logs in real-time. Container Apps lets you view a stream of your container's `stdout` and `stderr` log messages through the Azure portal or the Azure CLI.
14
+
While developing and troubleshooting your container app, it's essential to see the [logs](logging.md) for your container app in realtime. Azure Container Apps lets you stream:
16
15
17
-
## Azure portal
16
+
-[system logs](logging.md#system-logs) from the Container Apps environment and your container app.
17
+
- container [console logs](logging.md#container-console-logs) from your container app.
18
18
19
-
View a container app's log stream in the Azure portal with these steps.
19
+
Log streams are accessible through the Azure portal or the Azure CLI.
20
20
21
-
1. Navigate to your container app in the Azure portal.
21
+
## View log streams via the Azure portal
22
+
23
+
You can view system logs and console logs in the Azure portal. System logs are generated by the container app's runtime. Console logs are generated by your container app.
24
+
25
+
### Environment system log stream
26
+
27
+
To troubleshoot issues in your container app environment, you can view the system log stream from your environment page. The log stream displays the system logs for the Container Apps service and the apps actively running in the environment:
28
+
29
+
1. Go to your environment in the Azure portal.
22
30
1. Select **Log stream** under the *Monitoring* section on the sidebar menu.
23
-
1. If you have multiple revisions, replicas, or containers, you can select from the pull-down menus to choose a container. If your app has only one container, you can skip this step.
24
31
25
-
After a container is selected, the log stream is displayed in the viewing pane.
32
+
:::image type="content" source="media/observability/system-log-streaming-env.png" alt-text="Screenshot of Container Apps environment system log stream page.":::
You can view a log stream of your container app's system or console logs from your container app page.
37
+
38
+
1. Go to your container app in the Azure portal.
39
+
1. Select **Log stream** under the *Monitoring* section on the sidebar menu.
40
+
1. To view the console log stream, select **Console**.
41
+
1. If you have multiple revisions, replicas, or containers, you can select from the drop-down menus to choose a container. If your app has only one container, you can skip this step.
28
42
29
-
## Azure CLI
43
+
:::image type="content" source="media/observability/screenshot-log-stream-console-app.png" alt-text="Screenshot of Container Apps console log stream from app page.":::
30
44
31
-
You can view a container's log stream from the Azure CLI with the `az containerapp logs show` command. You can use these arguments to:
45
+
1. To view the system log stream, select **System**. The system log stream displays the system logs for all running containers in your container app.
32
46
33
-
- View previous log entries with the `--tail` argument.
34
-
- View a live stream with the `--follow`argument.
47
+
:::image type="content" source="media/observability/screenshot-log-stream-system-app.png" alt-text="Screenshot of Container Apps system log stream from app page.":::
35
48
36
-
Use `Ctrl/Cmd-C` to stop the live stream.
49
+
## View log streams via the Azure CLI
37
50
38
-
For example, you can list the last 50 container log entries in a container app with a single container using the following command.
51
+
You can view your container app's log streams from the Azure CLI with the `az containerapp logs show` command or your container app's environment system log stream with the `az containerapp env logs show` command.
39
52
40
-
This example live streams a container's log entries.
53
+
Control the log stream with the following arguments:
54
+
55
+
-`--tail` (Default) View the last n log messages. Values are 0-300 messages. The default is 20.
56
+
-`--follow` View a continuous live stream of the log messages.
57
+
58
+
### Stream Container app logs
59
+
60
+
You can stream the system or console logs for your container app. To stream the container app system logs, use the `--type` argument with the value `system`. To stream the container console logs, use the `--type` argument with the value `console`. The default is `console`.
61
+
62
+
#### View container app system log stream
63
+
64
+
This example uses the `--tail` argument to display the last 50 system log messages from the container app. Replace the \<placeholders\> with your container app's values.
41
65
42
66
# [Bash](#tab/bash)
43
67
44
68
```azurecli
45
69
az containerapp logs show \
46
70
--name <ContainerAppName> \
47
71
--resource-group <ResourceGroup> \
72
+
--type system \
48
73
--tail 50
49
74
```
50
75
@@ -54,20 +79,49 @@ az containerapp logs show \
54
79
az containerapp logs show `
55
80
--name <ContainerAppName> `
56
81
--resource-group <ResourceGroup> `
82
+
--type system `
57
83
--tail 50
58
84
```
59
85
60
86
---
61
87
62
-
To connect to a container console in a container app with multiple revisions, replicas, and containers include the following parameters in the `az containerapp logs show` command.
88
+
This example displays a continuous live stream of system log messages from the container app using the `--follow` argument. Replace the \<placeholders\> with your container app's values.
89
+
90
+
# [Bash](#tab/bash)
91
+
92
+
```azurecli
93
+
az containerapp logs show \
94
+
--name <ContainerAppName> \
95
+
--resource-group <ResourceGroup> \
96
+
--type system \
97
+
--follow
98
+
```
99
+
100
+
# [PowerShell](#tab/powershell)
101
+
102
+
```azurecli
103
+
az containerapp logs show `
104
+
--name <ContainerAppName> `
105
+
--resource-group <ResourceGroup> `
106
+
--type system `
107
+
--follow
108
+
```
109
+
110
+
---
111
+
112
+
Use `Ctrl-C` or `Cmd-C` to stop the live stream.
113
+
114
+
### View container console log stream
115
+
116
+
To connect to a container's console log stream in a container app with multiple revisions, replicas, and containers, include the following parameters in the `az containerapp logs show` command.
63
117
64
118
| Argument | Description |
65
119
|----------|-------------|
66
-
|`--revision`| The revision name of the container to connect to. |
67
-
|`--replica`| The replica name of the container to connect to. |
68
-
|`--container`| The container name of the container to connect to. |
120
+
|`--revision`| The revision name. |
121
+
|`--replica`| The replica name in the revision. |
122
+
|`--container`| The container name to connect to. |
69
123
70
-
You can get the revision names with the `az containerapp revision list` command. Replace the \<placeholders\> with your container app's values.
124
+
You can get the revision names with the `az containerapp revision list` command. Replace the \<placeholders\> with your container app's values.
71
125
72
126
# [Bash](#tab/bash)
73
127
@@ -113,8 +167,7 @@ az containerapp replica list `
113
167
114
168
---
115
169
116
-
Stream the container logs with the `az container app show` command. Replace the \<placeholders\> with your container app's values.
117
-
170
+
Live stream the container console using the `az container app show` command with the `--follow` argument. Replace the \<placeholders\> with your container app's values.
118
171
119
172
# [Bash](#tab/bash)
120
173
@@ -125,6 +178,7 @@ az containerapp logs show \
125
178
--revision <RevisionName> \
126
179
--replica <ReplicaName> \
127
180
--container <ContainerName> \
181
+
--type console \
128
182
--follow
129
183
```
130
184
@@ -137,13 +191,91 @@ az containerapp logs show `
137
191
--revision <RevisionName> `
138
192
--replica <ReplicaName> `
139
193
--container <ContainerName> `
194
+
--type console `
195
+
--follow
196
+
```
197
+
198
+
---
199
+
200
+
Use `Ctrl-C` or `Cmd-C` to stop the live stream.
201
+
202
+
View the last 50 console log messages using the `az containerapp logs show` command with the `--tail` argument. Replace the \<placeholders\> with your container app's values.
203
+
204
+
# [Bash](#tab/bash)
205
+
206
+
```azurecli
207
+
az containerapp logs show \
208
+
--name <ContainerAppName> \
209
+
--resource-group <ResourceGroup> \
210
+
--revision <RevisionName> \
211
+
--replica <ReplicaName> \
212
+
--container <ContainerName> \
213
+
--type console \
214
+
--tail 50
215
+
```
216
+
217
+
# [PowerShell](#tab/powershell)
218
+
219
+
```azurecli
220
+
az containerapp logs show `
221
+
--name <ContainerAppName> `
222
+
--resource-group <ResourceGroup> `
223
+
--revision <RevisionName> `
224
+
--replica <ReplicaName> `
225
+
--container <ContainerName> `
226
+
--type console `
227
+
--tail 50
228
+
```
229
+
230
+
---
231
+
232
+
### View environment system log stream
233
+
234
+
Use the following command with the `--follow` argument to view the live system log stream from the Container Apps environment. Replace the \<placeholders\> with your environment values.
235
+
236
+
# [Bash](#tab/bash)
237
+
238
+
```azurecli
239
+
az containerapp env logs show \
240
+
--name <ContainerAppEnvironmentName> \
241
+
--resource-group <ResourceGroup> \
242
+
--follow
243
+
```
244
+
245
+
# [PowerShell](#tab/powershell)
246
+
247
+
```azurecli
248
+
az containerapp env logs show `
249
+
--name <ContainerAppEnvironmentName> `
250
+
--resource-group <ResourceGroup> `
140
251
--follow
141
252
```
142
253
143
254
---
144
255
256
+
Use `Ctrl-C` or `Cmd-C` to stop the live stream.
145
257
146
-
Enter **Ctrl-C** to stop the log stream.
258
+
This example uses the `--tail` argument to display the last 50 environment system log messages. Replace the \<placeholders\> with your environment values.
259
+
260
+
# [Bash](#tab/bash)
261
+
262
+
```azurecli
263
+
az containerapp env logs show \
264
+
--name <ContainerAppName> \
265
+
--resource-group <ResourceGroup> \
266
+
--tail 50
267
+
```
268
+
269
+
# [PowerShell](#tab/powershell)
270
+
271
+
```azurecli
272
+
az containerapp env logs show `
273
+
--name <ContainerAppName> `
274
+
--resource-group <ResourceGroup> `
275
+
--tail 50
276
+
```
277
+
278
+
---
147
279
148
280
> [!div class="nextstepaction"]
149
-
> [View log streams from the Azure portal](log-streaming.md)
281
+
> [Log storage and monitoring options in Azure Container Apps](log-monitoring.md)
Copy file name to clipboardExpand all lines: articles/container-apps/logging.md
+8-10Lines changed: 8 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,36 +14,34 @@ ms.author: v-bcatherine
14
14
15
15
Azure Container Apps provides two types of application logging categories:
16
16
17
-
-[Container console logs](#container-console-logs): Log streams from your container console.
18
-
-[System logs](#system-logs): Logs generated by the Azure Container Apps service.
17
+
-[Container console logs](#container-console-logs): Log streams from your container console.
18
+
-[System logs](#system-logs): Logs generated by the Azure Container Apps service.
19
19
20
+
You can view the [log streams](log-streaming.md) in near real-time in the Azure portal or CLI. For more options to store and monitor your logs, see [Logging options](log-options.md).
20
21
21
22
## Container console Logs
22
23
23
-
Container console logs are written by your application to the `stdout` and `stderr` output streams of the application's container. By implementing detailed logging in your application, you'll be able to troubleshoot issues and monitor the health of your application.
24
-
25
-
You can view your container console logs through [Logs streaming](log-streaming.md). For other options to store and monitoring your log data, see [Logging options](log-options.md).
24
+
Container Apps captures the `stdout` and `stderr` output streams from your application containers and displays them as console logs. When you implement logging in your application, you can troubleshoot problems and monitor the health of your app.
26
25
27
26
## System logs
28
27
29
-
System logs are generated by the Azure Container Apps to inform you for the status of service level events. Log messages include the following information:
28
+
Container Apps generates system logs to inform you of the status of service level events. Log messages include the following information:
30
29
31
30
- Successfully created dapr component
32
31
- Successfully updated dapr component
33
32
- Error creating dapr component
34
33
- Successfully mounted volume
35
34
- Error mounting volume
36
35
- Successfully bound Domain
37
-
- Auth enabled on app. Creating authentication config
36
+
- Auth enabled on app
37
+
- Creating authentication config
38
38
- Auth config created successfully
39
-
- Setting a traffic weight
39
+
- Setting a traffic weight
40
40
- Creating a new revision:
41
41
- Successfully provisioned revision
42
42
- Deactivating Old revisions
43
43
- Error provisioning revision
44
44
45
-
The system log data can be stored and monitored through the Container Apps logging options. For more information, see [Logging options](log-options.md).
0 commit comments