Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9289293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T20:08:30+00:00 2026-06-18T20:08:30+00:00

I am running a web server, tornado, and I am trying to redirect all

  • 0

I am running a web server, tornado, and I am trying to redirect all the log output to a file using the following command. But I don’t see the output in the file.

/usr/bin/python -u index.py 2>&1 >> /tmp/tornado.log

I pass -u option to python interpreter. I still don’t see any output logged to my log file.

However, I see the output on stdout when I do the following

/usr/bin/python index.py
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T20:08:32+00:00Added an answer on June 18, 2026 at 8:08 pm

    Tornado uses the built-in logging module. You can easily attach a file handler to the root logger and set its level to NOTSET so it records everything, or some other level if you want to filter.

    Reference docs: logging, logging.handlers

    Example that works with Tornado’s logging:

    import logging
    # the root logger is created upon the first import of the logging module
    
    # create a file handler to add to the root logger
    filehandler = logging.FileHandler(
        filename = 'test.log', 
        mode = 'a', 
        encoding = None, 
        delay = False
    )
    
    # set the file handler's level to your desired logging level, e.g. INFO
    filehandler.setLevel(logging.INFO)
    
    # create a formatter for the file handler
    formatter = logging.Formatter('%(asctime)s.%(msecs)d  [%(name)s](%(process)d): %(levelname)s: %(message)s')
    
    # add filters if you want your handler to only handle events from specific loggers 
    # e.g. "main.sub.classb" or something like that. I'll leave this commented out.
    # filehandler.addFilter(logging.Filter(name='root.child'))
    
    # set the root logger's level to be at most as high as your handler's
    if logging.root.level > filehandler.level:
        logging.root.setLevel = filehandler.level
    
    # finally, add the handler to the root. after you do this, the root logger will write
    # records to file.
    logging.root.addHandler(filehandler)
    

    More often than not, I actually wish to suppress tornado’s loggers (because I have my own, and catch their exceptions anyway, and they just end up polluting my logs,) and this is where adding a filter on your filehandlers can come in very handy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I am running a web server using embedded jetty and the maven app-assembler
I'm running a web app in Jboss application server and I'm trying to implement
I'm quite new to using Tornado Web as a web server, and am having
I'm trying to redirect all errors on the server back to my application so
I am trying to run the following HelloWorld Script at Command Line import tornado.httpserver
PC1 is running IIS web server over a home network . I'm trying to
I m trying to access a web server running on android emulator from my
I am running a web server using VB.net and I have a bunch of
I'm running a web server using XAMPP. I have using a web form to
I'm trying to implement a C# web socket server, but its giving me a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.