Skip to content
Discussion options

You must be logged in to vote

The logger handler behaviour is not reliably inherited to child process. When you do it in main. Especially when using spawn / Windows?

What if you do it inside @app.on_worker_start?

@app.on_worker_start
async def worker_start(app):
    handler = RotatingFileHandler("app.log", maxBytes=10240, backupCount=3)
    app.logger.addHandler(handler)


@app.route('/')
async def index(request, logger, **server):
    session = request.ctx.session
    logger.info('Current page: /')

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@ockan
Comment options

@nggit
Comment options

nggit Dec 4, 2025
Maintainer

Answer selected by ockan
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