2017-06-24 7 views
0

メッセージ「すべてのジョブの実行」を抑制:スケジュールパッケージ:私は現在のプロジェクトのためのスケジュール」を使用してい

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

それは素晴らしいことだが、私は「X秒ごとに実行中のジョブ」抑制したいですスケジュールされたタスクが実行されるたびにトリガーされるログメッセージ。私は以下の何を意味するかの例:

enter image description here

これを実現する方法はありますか?

# 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) 
+0

githubリポジトリにはこの[問題](https://github.com/dbader/ schedule /issues/30)があります。また、静かな仕事のオプションで[pull request](https://github.com/dbader/schedule/pull/76)があります。 – Meloman

+1

また、この[質問](https://stackoverflow.com/questions/11029717/how-do-i-disable-log-messages-from-the-requests-library)を参照してください。ロガーのレベルを 'logging.DEBUG'に設定したいとします。 – Meloman

+0

素晴らしい、ありがとう@Meloman、仕事を完璧にやった。 – itzafugazi

答えて

0

Melomanが指摘したように、あなたが直接、個人のスケジュールを設定することができます。以下は、私の現在のlogging.basicConfigあるソリューションはそれともっとあるのかもしれないので、私は、絶対的な基礎を超えてロギングを設定するにはかなり新しいです'loggerをINFOよりも高いレベルに設定します。

logging.getLogger('schedule').setLevel(logging.CRITICAL) 
関連する問題