0

I'm using the logging python library for logging. I've selected logging.handlers.RotatingFileHandler as one of the handlers. it's working on localhost but not on the production server.

file: &file_defaults
class: logging.handlers.RotatingFileHandler
level: DEBUG
formatter: simple
filename: server_development.log
maxBytes: 10240000
backupCount: 10

Any ideas why ?

WebQube
  • 8,510
  • 12
  • 51
  • 93
  • have you tried to cleanup *.pyc files on the prod machine? – Denis Olehov Feb 07 '17 at 07:53
  • @DenisOlehov it worked, but no idea why. this code +config hasn't changed in a while so what's the relation to pyc files? – WebQube Feb 07 '17 at 11:24
  • Because *.pyc files contain compiled .py code. Since they haven't been changed your interpreter have used the "old" (compiled) version of the code. So that's why you get the incorrect behavior. – Denis Olehov Feb 07 '17 at 11:55

1 Answers1

1

Remove .pyc files on the prod machine:

cd /path/to/your/project && find . -name \*.pyc -delete

*.pyc files contain compiled .py code. Since they haven't been changed your interpreter have used the "old" (compiled) version of the code. So that's why you get the incorrect behavior.

More on *.pyc files.

Community
  • 1
  • 1
Denis Olehov
  • 192
  • 2
  • 12