Enum AwsLogDriverMode

java.lang.Object
java.lang.Enum<AwsLogDriverMode>
software.amazon.awscdk.services.ecs.AwsLogDriverMode
All Implemented Interfaces:
Serializable, Comparable<AwsLogDriverMode>, java.lang.constant.Constable

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:47.011Z") @Stability(Stable) public enum AwsLogDriverMode extends Enum<AwsLogDriverMode>
awslogs provides two modes for delivering messages from the container to the log driver.

Example:

 Cluster cluster;
 // Create a Task Definition for the container to start
 Ec2TaskDefinition taskDefinition = new Ec2TaskDefinition(this, "TaskDef");
 taskDefinition.addContainer("TheContainer", ContainerDefinitionOptions.builder()
         .image(ContainerImage.fromAsset(resolve(__dirname, "..", "eventhandler-image")))
         .memoryLimitMiB(256)
         .logging(AwsLogDriver.Builder.create().streamPrefix("EventDemo").mode(AwsLogDriverMode.NON_BLOCKING).build())
         .build());
 // An Rule that describes the event trigger (in this case a scheduled run)
 Rule rule = Rule.Builder.create(this, "Rule")
         .schedule(Schedule.expression("rate(1 min)"))
         .build();
 // Pass an environment variable to the container 'TheContainer' in the task
 rule.addTarget(EcsTask.Builder.create()
         .cluster(cluster)
         .taskDefinition(taskDefinition)
         .taskCount(1)
         .containerOverrides(List.of(ContainerOverride.builder()
                 .containerName("TheContainer")
                 .environment(List.of(TaskEnvironmentVariable.builder()
                         .name("I_WAS_TRIGGERED")
                         .value("From CloudWatch Events")
                         .build()))
                 .build()))
         .build());
 
  • Enum Constant Details

    • BLOCKING

      @Stability(Stable) public static final AwsLogDriverMode BLOCKING
      (default) direct, blocking delivery from container to driver.
    • NON_BLOCKING

      @Stability(Stable) public static final AwsLogDriverMode NON_BLOCKING
      The non-blocking message delivery mode prevents applications from blocking due to logging back pressure.

      Applications are likely to fail in unexpected ways when STDERR or STDOUT streams block.

  • Method Details

    • values

      public static AwsLogDriverMode[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static AwsLogDriverMode valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null