2021-02-03 09:30:42 -06:00
---
2023-06-02 21:41:36 -07:00
title_tag: "Logging | Pulumi Concepts"
2021-02-03 09:30:42 -06:00
meta_desc: An overview of the Pulumi logging functionality used for debugging and diagnostics.
2023-05-15 15:25:28 -07:00
title: "Logging"
h1: "Logging"
2023-06-08 16:15:52 -07:00
meta_image: /images/docs/meta-images/docs-meta.png
2021-02-03 09:30:42 -06:00
menu:
2023-05-15 15:25:28 -07:00
concepts:
2023-10-05 10:43:11 -07:00
weight: 10
2023-05-15 15:25:28 -07:00
aliases:
- /docs/intro/concepts/logging/
2021-02-03 09:30:42 -06:00
---
2023-04-11 13:40:50 -07:00
The {{< pulumi-log > }} collection of functions allow you to log diagnostics, warnings, or errors with the Pulumi engine. These are displayed, alongside all other Pulumi output, in the CLI and in the Pulumi Cloud. Events are logged and kept for historical purposes in case you want to audit or diagnose a past event.
2021-02-03 09:30:42 -06:00
2022-05-03 21:23:32 -07:00
{{< chooser language " javascript , typescript , python , go , csharp , java " > }}
2021-02-03 09:30:42 -06:00
{{% choosable language javascript %}}
```javascript
pulumi.log.info("message")
pulumi.log.info("message", resource)
pulumi.log.debug("hidden by default")
pulumi.log.warn("warning")
pulumi.log.error("fatal error")
```
{{% /choosable %}}
{{% choosable language typescript %}}
```typescript
pulumi.log.info("message")
pulumi.log.info("message", resource)
pulumi.log.debug("hidden by default")
pulumi.log.warn("warning")
pulumi.log.error("fatal error")
```
{{% /choosable %}}
{{% choosable language python %}}
```python
log.info("message")
log.info("message", resource)
log.debug("hidden by default")
log.warn("warning")
log.error("fatal error")
```
{{% /choosable %}}
{{% choosable language go %}}
```go
// Optional arguments for logging.
args := & pulumi.LogArgs{
Resource: resource,
StreamID: 0,
Ephemeral: false,
}
ctx.Log.Info("message", nil)
ctx.Log.Info("message", args)
ctx.Log.Debug("hidden by default", nil)
ctx.Log.Warn("warning", nil)
ctx.Log.Error("fatal error", nil)
```
{{% /choosable %}}
{{% choosable language csharp %}}
```csharp
Pulumi.Log.Info("message");
Pulumi.Log.Info("message", resource);
Pulumi.Log.Debug("hidden by default");
Pulumi.Log.Warn("warning");
Pulumi.Log.Error("fatal error");
```
2022-05-03 21:23:32 -07:00
{{% /choosable %}}
{{% choosable language java %}}
```java
public static void stack(Context ctx) {
2022-08-22 23:16:03 +05:30
ctx.log().info("message");
ctx.log().info("message", resource);
ctx.log().debug("hidden by default");
ctx.log().warn("warning");
ctx.log().error("fatal error");
2022-05-03 21:23:32 -07:00
}
```
2021-02-03 09:30:42 -06:00
{{% /choosable %}}
{{< / chooser > }}
2022-10-26 07:22:15 -07:00
For information on how to use diagnostic information for troubleshooting, see [Diagnosing Issues ](/docs/support/troubleshooting#diagnosing-issues ).