ApplicationLogLevel

class aws_cdk.aws_lambda.ApplicationLogLevel(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Lambda service automatically captures logs generated by the function code (known as application logs) and sends these logs to a default CloudWatch log group named after the Lambda function.

ExampleMetadata:

infused

Example:

from aws_cdk.aws_logs import ILogGroup

# log_group: ILogGroup


lambda_.Function(self, "Lambda",
    code=lambda_.InlineCode("foo"),
    handler="index.handler",
    runtime=lambda_.Runtime.NODEJS_18_X,
    logging_format=lambda_.LoggingFormat.JSON,
    system_log_level_v2=lambda_.SystemLogLevel.INFO,
    application_log_level_v2=lambda_.ApplicationLogLevel.INFO,
    log_group=log_group
)

Attributes

DEBUG

Lambda will capture only logs at debug level.

ERROR

Lambda will capture only logs at error level.

FATAL

Lambda will capture only logs at fatal level.

INFO

Lambda will capture only logs at info level.

TRACE

Lambda will capture only logs at trace level.

WARN

Lambda will capture only logs at warn level.