1. Docs
  2. Pulumi IaC
  3. Concepts
  4. Logging

Logging

    The pulumi.log.debug/info/warn/error pulumi.log.debug/info/warn/error pulumi.debug/info/warn/error log Log.Debug/Info/Warn/Error 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.

    pulumi.log.info("message")
    pulumi.log.info("message", resource)
    pulumi.log.debug("hidden by default")
    pulumi.log.warn("warning")
    pulumi.log.error("fatal error")
    
    pulumi.log.info("message")
    pulumi.log.info("message", resource)
    pulumi.log.debug("hidden by default")
    pulumi.log.warn("warning")
    pulumi.log.error("fatal error")
    
    pulumi.info("message")
    pulumi.info("message", resource)
    pulumi.debug("hidden by default")
    pulumi.warn("warning")
    pulumi.error("fatal error")
    
    // 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)
    
    Pulumi.Log.Info("message");
    Pulumi.Log.Info("message", resource);
    Pulumi.Log.Debug("hidden by default");
    Pulumi.Log.Warn("warning");
    Pulumi.Log.Error("fatal error");
    
    public static void stack(Context ctx) {
        ctx.log().info("message");
        ctx.log().info("message", resource);
        ctx.log().debug("hidden by default");
        ctx.log().warn("warning");
        ctx.log().error("fatal error");
    }
    

    For information on how to use diagnostic information for troubleshooting, see Diagnosing Issues.

      PulumiUP 2024. Watch On Demand.