代码之家  ›  专栏  ›  技术社区  ›  Lariat

AWS Cloud Watch不可读符号

  •  0
  • Lariat  · 技术社区  · 9 年前

    django:
    ...
    logging:
      driver: "awslogs"
      options:
        awslogs-region: "eu-central-1"
        awslogs-group: "my-group-auto"
        awslogs-stream: "my-stream"
        awslogs-create-group: "true"
    

    LOGGING = {
      'version': 1,
      'disable_existing_loggers': True,
      'root': {
         'level': 'ERROR',
         'handlers': ['console'],
      },
      'formatters': {
         'message-only': {
            'format': '%(message)s'
         }
      },
      'handlers': {
         'console': {
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',
            'formatter': 'message-only'
         }
      },
      'loggers': {
         'celery': {
            'level': 'DEBUG',
            'handlers': ['console'],
            'propagate': False,
         }
      }
    }
    

    然后我运行python shell并尝试发送一些日志:

    In [1]: import logging
    In [2]: logger = logging.getLogger('celery')
    In [3]: logger.info('info2')
    In [4]: logger.info('info22')
    

    16:34:27    [J[?7h[0m[?12l[?25h[?2004linfo2
    16:35:23    [J[?7h[0m[?12l[?25h[?2004linfo22
    

    1 回复  |  直到 9 年前
        1
  •  1
  •   Tarun Lalwani    9 年前

    为此,您需要尝试python。IPython可能正在用颜色增强日志,而您看到的字符是颜色编码。