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

Improve logging #30

Closed
analytically opened this issue Dec 18, 2014 · 8 comments · Fixed by #193
Closed

Improve logging #30

analytically opened this issue Dec 18, 2014 · 8 comments · Fixed by #193

Comments

@analytically
Copy link

Right now we're seeing:

2014-11-28 17:31:53,074 [PID 12] INFO - Running job Every 90 seconds do threaded(<function quoter at 0x7f739e3e00c8>) (last run: 2014-11-28 17:30:22, next run: 2014-11-28 17:31:5$

It'd be nice if this would be slightly more concise. Eg.

2014-11-28 17:31:53,074 [PID 12] INFO - Running every 90 seconds 'threaded(<function quoter at 0x7f739e3e00c8>)' (last run: 17:30:22, next run: 17:31:50)
@dbader
Copy link
Owner

dbader commented Feb 12, 2015

Good suggestion. I think the wording schedule uses currently could be improved. I want to keep the full date around though for last run / next run because sometimes jobs will be scheduled days in advance.

@dbader
Copy link
Owner

dbader commented Feb 12, 2015

By the way let me know if you want to put together a pull-request with some of these improvements.

@Toshibass
Copy link

Schedule is really useful, I like it but, regarding improved logging, one small thing I don't get , using the example below why is next run:17:31:50 actually the time of this run 2014-11-28 17:31:53 .... It would be much more useful to advise when the next actual run would be, like if the example is running every 10 minutes then next run should say 17:41.50

2015-02-13 17:31:53 - INFO - Running job Every 10 minutes do job1() (last run: 2015-02-13 17:21:22, next run: 2015-02-13 17:31:50)

Toshi

@DieterKoblenz
Copy link

Is there a way to disable logging all together? I use logging in my application and these logs (for example the job I run every 5 seconds) interfere a lot. (I've set my log up as a csv file which I can import in an mysql database every day)

@MelomanCool
Copy link

MelomanCool commented Jun 28, 2017

Is there a way to disable logging all together?

You can set the schedule logger's level manually:

logging.getLogger('schedule').setLevel(logging.DEBUG)

@zcking
Copy link
Contributor

zcking commented Jan 13, 2018

I would like to see more logging added to schedule in general. Currently, the only logs are from Job.run()) and Scheduler.run_all(). It would be useful to also see info logging added for the following:

  • Scheduler.cancel_job()
  • Scheduler.clear()

A default logger configuration would also be great to provide the usual logging info (timestamp, level, etc.).

I've opened a PR if you're interested: #193

@zspatter
Copy link

zspatter commented Aug 4, 2019

Is there an option to disable args/kwargs from being included in the logging messages when jobs run? I would like to include these logging messages in my logs (particularly job frequency, last run, and next run). However; the arguments I'm passing through the scheduler involve sensitive information that I don't want to be stored in plaintext.

Optionally removing args/kwargs from the logging would also allow the messages to be more concise. Unfortunately, I'm forced to disable the logger for schedule as a workaround for the time being.

Are there any other solutions I'm overlooking without overriding the __repr__ in Job?

@SijmenHuizenga
Copy link
Collaborator

Hi all! Thank you all for the good suggestions. Here is an update on the current state:

On the subject of hiding sensitive information from log messages as raised by @zspatter; I don't think we should add a built-in switch for removing args from the logs as only few people need this and we want to keep this library simple. However, I would very much like to add add a good example of how to implement this in the documentation. We can experiment on the best way to do this: overriding some method or adding a decorator as described here, I'm open to suggestions. To track this, I've created #402

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

Successfully merging a pull request may close this issue.

8 participants