0

According to Python's documentation, under Windows "logging opens the files with exclusive locks".

In fact, in Django, with a configuration like this:

'handlers': {
    'logfile': {
        'level':'DEBUG',
        'class':'logging.handlers.RotatingFileHandler',
        'filename': 'myapp.log',
        'maxBytes': 1024 * 1024,
        'backupCount': 9,
        'formatter': 'standard',
    },
},

when the application is executed on Windows Azure Websites (under IIS + WSGI), the log file can't be read by any other application until the Django application is stopped.

Is there a way to log to a file under this environment (Windows Server, IIS, WSGI) without the file being opened in exclusive mode?

4

1 回答 1

1

您可以根据需要自行打开文件,并将生成的流传递给StreamHandler.

于 2013-07-28T22:17:46.957 回答