0

I have this example app:

test.py

import logging
logging.basicConfig(level=logging.INFO, filename='log/application.log')

print abc

When I run this app "python test.py" it will raise an SyntaxError because of the print statement (python 3).

Why is that error not logged in the log-file?

caliph
  • 1,389
  • 3
  • 27
  • 52
  • 1
    Because it does not log errors automatically, if not configured to do so. – Klaus D. Oct 27 '17 at 11:16
  • 1
    Possible duplicate of [Using python's logging module to log all exceptions and errors](https://stackoverflow.com/questions/8050775/using-pythons-logging-module-to-log-all-exceptions-and-errors) – Klaus D. Oct 27 '17 at 11:17
  • 1
    Also a syntax error might be fatal enough to prevent the execution of the whole module. – Klaus D. Oct 27 '17 at 11:19
  • Hmm. Whats a good (and simple) solution then to log the tracebacks and exeptions on a prodction server? – caliph Oct 27 '17 at 11:43
  • You should read the comments more carefully. – Klaus D. Oct 27 '17 at 11:45

0 Answers0