Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am running a wsgi based application that has concurrent users accessing it. For my logs needs I tried logrotate but found that logrotate is not too friendly to Python applications, so I tried using RotatingFileHandler and even worse found my logs all chopped up and part of it went missing!

I am considering ConcurrentRotatingFileHandler, my question is, has anyone out there experienced the same thing and better yet do you have any battle tested solution for Python wsgi, concurrently accessed applications?

share|improve this question
add comment

2 Answers

What was the problem with logrotate ? You may have a look at chronolog. It's mostly for web logs.

share|improve this answer
add comment

if you use a newer version of python the logging module has support to rotate logs.

# Add the log message handler to the logger
handler = logging.handlers.RotatingFileHandler(
          LOG_FILENAME, maxBytes=20, backupCount=5)

look at http://docs.python.org/library/logging.html

i assume you use a built in web server as CherryPy.

share|improve this answer
    
Thanks for the answer, I used it initially but I found my logs all butchered up and could not make head or tails of the logs. I used the usual settings of 'a' and 2 for logs. –  Low Kian Seong Jan 9 '11 at 5:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.