Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Setting Log Handler Formatter

Đang mở
#189 0 bình luận 1 reaction 1 người được giao Xem trên GitHub

@ericzbeard đang làm issue này rồi.

Từ ngày 13/10/2022.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

enhancement investigating p2

I'd like to have logs formatted using ecs_logging and noticed adding a handler to my app does nothing to change the log format in the CloudWatch LogGroup.

This for example has no impact to log format:

LOGGER = logging.getLogger(__package__)
LOGGER.setLevel(level=logging.INFO)
handler = logging.StreamHandler()
handler.setFormatter(ecs_logging.StdlibFormatter())
LOGGER.addHandler(handler)

I also tried brute forcing the formatter with no luck:

def set_formatter():
    for logger in logging.root.manager.loggerDict.values():
        if isinstance(logger, logging.PlaceHolder):
            continue

        if logger.hasHandlers():
            for handler in logger.handlers:
                handler.setFormatter(ecs_logging.StdlibFormatter())

@hook.handler(HookInvocationPoint.CREATE_PRE_PROVISION)
def pre_create_handler(
    session: Optional[SessionProxy],
    request: BaseHookHandlerRequest,
    callback_context: MutableMapping[str, Any],
    type_configuration: TypeConfigurationModel,
) -> ProgressEvent:
    set_formatter()
    LOGGER.info(jsonify_hook_context(request=request))
    return ProgressEvent(status=OperationStatus.SUCCESS)

Is there a way to set the format for log output using this library?

Ngôn ngữ chính
Python
Star
107
Fork
46
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của aws-cloudformation/cloudformation-cli-python-plugin

Tất cả issue của aws-cloudformation/cloudformation-cli-python-plugin

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.