I know this question was already asked several times, but I just can't get it to work. I already spent half a day trying dozens of combinations, and again now and it is still not working.
In my code, I am logging at several parts, like within a try-except or to log some infos from management commands. I'm doing just very normal stuff, that is working on several local installs and on some Nginx servers.
A python file like this one :
import logging
logger = logging.getLogger(__name__)
logger.info('some important infos')
With following as minimal settings.py (I tried without stream indication, without the loggers specified, with named loggers, almost all possible combinations and I also tried much more complex ones)
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'level': 'INFO',
'class': 'logging.StreamHandler',
'stream': sys.stdout
}
},
'loggers': {
'django': {
'handlers': ['console'],
'propagate': True,
'level': 'INFO',
},
'': {
'handlers': ['console'],
'level': 'INFO',
}
}
}
Then also simply tested from the shell heroku run python
import logging
level = logging.INFO
handler = logging.StreamHandler()
handler.setLevel(level)
handler.setFormatter(logging.Formatter('%(levelname)s: %(message)s'))
logger = logging.getLogger('info')
logger.addHandler(handler)
logger.setLevel(level) #even if not required...
logger.info('logging test')
The last one may show up as "print" statement in the console, but neither here nor from the command or the server, nothing never shows up in heroku logs
....
EDIT: actually I have some entries showing up, application logs like following, just not mine:
2013-09-20T15:00:16.405492+00:00 heroku[run.2036]: Process exited with status 0
2013-09-20T15:00:17+00:00 app[heroku-postgres]: source=HEROKU_POSTGRESQL_OLIVE sample[...]
2013-09-20T14:59:47.403049+00:00 heroku[router]: at=info method=GET path=/
2013-09-20T14:59:16.304397+00:00 heroku[web.1]: source=web.1 dyno=heroku [...]
I also tried to look for entries using several addons. I had for a moment at the beginning newrelic, which I then also deactivated from the WSGI start-up. I don't remember if at that time it worked well, the free test period of newrelic is rather short.
Well, I don't know what I could try else... Thanks for any hint
See Question&Answers more detail:
os