gpt4 book ai didi

amazon-web-services - Cloudformation Registry 在提交私有(private)资源类型时不创建日志组

转载 作者:行者123 更新时间:2023-12-03 07:22:29 25 4
gpt4 key购买 nike

我正在开发一个private resource type对于 AWS Cloudformation Registry 。我设计了我的模型架构并开发了我的处理程序代码,submitted它,甚至成功部署了一个具有我自己的私有(private)资源类型的堆栈。耶。

我现在需要做的是检查其日志记录。由于我使用 cfn init 命令生成了脚手架,因此我只是将日志记录条目添加到现有的记录器对象中。

例如

# Use this logger to forward log messages to CloudWatch Logs.
LOG = logging.getLogger(__name__)
TYPE_NAME = "Myself::Test::Resourceful"

resource = Resource(TYPE_NAME, ResourceModel)
test_entrypoint = resource.test_entrypoint


@resource.handler(Action.CREATE)
def create_handler(
session: Optional[SessionProxy],
request: ResourceHandlerRequest,
callback_context: MutableMapping[str, Any],
) -> ProgressEvent:
model = request.desiredResourceState
progress: ProgressEvent = ProgressEvent(
status=OperationStatus.IN_PROGRESS,
resourceModel=model,
)
# TODO: put code here

LOG.info('Creating....')

根据literature ,

When you register a resource type using cfn submit, CloudFormationcreates a CloudWatch log group for the resource type in your account.This enables you to access the logs for your resource to help youdiagnose any faults. The log group is named according to the followingpattern:

/my-resource-type-stack-ResourceHandler-string

Now, when you initiate stack operations for stacks that contain theresource type, CloudFormation delivers log events emitted by theresource type to this log group.

但是,当提交我的资源类型(甚至部署它)时,无法看到在 CloudWatch 中创建的任何 LogGroup。显然我在这里缺少一些东西。

请帮助我了解如何查找我的私有(private) Cloudformation 注册表资源类型的日志记录。

当然,我很乐意提供所需的任何其他信息。谢谢!

最佳答案

明白了。

感谢@maslick ,我所要做的就是明确设置适当的日志记录级别

# Use this logger to forward log messages to CloudWatch Logs.

LOG = logging.getLogger(__name__)
LOG.setLevel(logging.INFO) # <- this line was missing

部署堆栈时,会出现日志组。耶。

关于amazon-web-services - Cloudformation Registry 在提交私有(private)资源类型时不创建日志组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73731518/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com