Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging to files doesn't function the same with coloredlogs installed #73

Open
Winning117 opened this issue Jul 5, 2019 · 0 comments
Open

Comments

@Winning117
Copy link

Winning117 commented Jul 5, 2019

With the following settings in my log_config.json I am able to log DEBUG to console and DEBUG to a file (without coloredlogs installed).

  "version": 1,
  "disable_existing_loggers": true,
  "formatters": {
    "standard": {
      "class": "logging.Formatter",
      "format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
    }
  },
  "handlers": {
    "console": {
      "class": "logging.StreamHandler",
      "formatter": "standard",
      "level": "DEBUG", # <---- Normally this setting is what decides the log level of your console (i.e. setting to DEBUG will show debug info in console). With coloredlogs it doesn't
      "stream": "ext://sys.stdout"
    },
    "timed_rotating_file_handler": {
      "class": "logging.handlers.TimedRotatingFileHandler",
      "encoding": "utf-8",
      "filename": "logs/MacEnvironmentSetup.log",
      "when": "midnight",
      "interval": 1,
      "backupCount": 2,
      "formatter": "standard",
      "level": "DEBUG"
    }
  },
  "loggers": {},
  "root": {
    "handlers": [
      "console",
      "timed_rotating_file_handler"
    ],
    "level": "DEBUG"
  }
}

If I use the same settings with coloredlogs installed, it will no longer direct DEBUG to the console. DEBUG now only shows up in the log file. This is the only line of code that I added in order to enable coloredlogs (aside from importing it): coloredlogs.install(milliseconds=True)

Is this a bug with coloredlogs, or is there a special way to set it up so that it can debug to the console as well? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant