Search code examples
pythonloggingtornado-motor

How to Begin with a Custom Error log function in python


I want to write a custom error log class, which would show me the errors returned by the code.
I don't use google app engine, I use python tornado framework.

So can anyone guide me with steps to follow.

I have actually got the steps to follow to create the custom logger from the below link:

Python: custom logging across all modules

But how do i actually store the logs in db and pull it and post it on my front end.


Solution

  • import logging
    
    logging.basicConfig(...)
    try:
        do.something()
    except Exception:
        logging.exception("aiii!")
    

    Eventually you'll want to move off basicConfig.