Skip to content

Disable DEBUG logging - only for rocketry #209

Answered by Jypear
psetzermann asked this question in Q&A
Discussion options

You must be logged in to vote

@psetzermann
This shouldn't be too tricky to do, it would just require a bit of manipulation of the logging module.
Specifically you would just need to change the logging level on the rocketry logger before running your scheduled tasks.

Example:

from rocketry import Rocketry
import logging

app = Rocketry()

logging.basicConfig(level=logging.DEBUG, format="%(asctime)s - %(levelname)s -  %(message)s")
logging.getLogger("rocketry.scheduler").setLevel(logging.INFO)

@app.task("every 3 seconds")
def do_task():
    print("Im inside the task")
    logging.debug("This is my log inside the task")

app.run()

output:

2023-08-23 12:52:00,802 - DEBUG -  Using selector: KqueueSelector
2023-08-23 12:5…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@psetzermann
Comment options

Answer selected by psetzermann
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants