0

I am running my pyramid application as systemd service.

sudo systemctl restart my_pyramid_app

I have added code as per this link to redirect my logs to a production.log file.

Now recently I have added some print commands for printing out the exception messages in my application. But I don't see any of these print commands being printed to production.log file.

I have checked the logs using below command as well, but didn't see my logs there either.

journalctl -u s4m_pyramid -S "1 week ago"

Here is my code for print commands. It is sitting in __init__.py file

@notfound_view_config()
def notfound(exc,request):
    print("Not found view!!!")
    print(request.exception)
    return redirect(url('/contents/error'))

@exception_view_config()
def error_view(exc,request):
    print("Exception view!!!")
    print(request.exception)
    return redirect(url('/contents/error'))

Any ideas where are my print command going

  • can you add your actual code? – Sufiyan Ghori Nov 01 '18 at 01:55
  • added code for print commands – ghanisht nagpal Nov 01 '18 at 03:40
  • Python 3 docs on the [`print` function](https://docs.python.org/3/library/functions.html#print) explains where output goes. Your statements go to `stdout` by default, which is the console. I would suggest you set up proper [logging as described in the Pyramid docs](https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html). – Steve Piercy Nov 01 '18 at 06:20

0 Answers0