0

I'm using 'schedule' for a current project:

https://pypi.python.org/pypi/schedule

It's great, but I want to suppress the "Running job Every x seconds" log message that gets triggered every time a scheduled task is run. Example of what I mean below:

enter image description here

Is there any way to achieve this? Below is my current logging.basicConfig, I'm quite new to configuring logging beyond the absolute basics, so the solution may lie more with that:

# Define overall logging settings; these log levels/format go to file
logging.basicConfig(level=variables.settings['log_level_file'],
                    format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
                    filename='logs\log.log')

# Set up Handlers and Formatters; these log levels/format go to console
console = logging.StreamHandler()
console.setLevel(variables.settings['log_level_console'])
formatter = logging.Formatter('%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
console.setFormatter(formatter)
logging.getLogger('').addHandler(console)
itzafugazi
  • 121
  • 1
  • 1
  • 7
  • The github repo has this [issue](https://github.com/dbader/schedule/issues/30). Also, there is a [pull request](https://github.com/dbader/schedule/pull/76) with the quiet job option. – Meloman Jun 24 '17 at 16:49
  • 1
    Also, see this [question](https://stackoverflow.com/questions/11029717/how-do-i-disable-log-messages-from-the-requests-library). You want to set the `'schedule'` logger's level to `logging.DEBUG`. – Meloman Jun 24 '17 at 16:59
  • Excellent, thanks @Meloman, that did the job perfectly. – itzafugazi Jun 24 '17 at 21:36

1 Answers1

0

As Meloman pointed out, you can directly set the individual 'schedule' logger to a higher level than the INFO default:

logging.getLogger('schedule').setLevel(logging.CRITICAL)
itzafugazi
  • 121
  • 1
  • 1
  • 7