Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

We use the Django logging module for our Django app, which runs on a couple of Apache instances on a server; each instance is a different setup, like production/staging/development/testing. How do I log the Apache instance name in the logger? Currently, I've tried this, and it only logs the machine name.

try:
    HOSTNAME = socket.gethostname()
except:
    HOSTNAME = 'localhost'

LOGGING = {
    'formatters': {
                  'standard': {
                              'format': '%(asctime)s [' + HOSTNAME + '] [%(levelname)s]:[%(lineno)s] - %(message)s'
                               },
    }
}

How do I identify the Apache instance here?

share|improve this question

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.