我有一個在Dotcloud上運行的Django應用程序。我嘗試添加Logentries記錄在正常使用情況我的網站工作,但引起我的cron作業失敗,此錯誤 -
Traceback (most recent call last): File "/home/dotcloud/current/my_project/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/home/dotcloud/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line utility.execute() File "/home/dotcloud/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/dotcloud/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 261, in fetch_command commands = get_commands() File "/home/dotcloud/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 107, in get_commands apps = settings.INSTALLED_APPS File "/home/dotcloud/env/local/lib/python2.7/site-packages/django/conf/__init__.py", line 54, in __getattr__ self._setup(name) File "/home/dotcloud/env/local/lib/python2.7/site-packages/django/conf/__init__.py", line 50, in _setup self._configure_logging() File "/home/dotcloud/env/local/lib/python2.7/site-packages/django/conf/__init__.py", line 80, in _configure_logging logging_config_func(self.LOGGING) File "/usr/lib/python2.7/logging/config.py", line 777, in dictConfig dictConfigClass(config).configure() File "/usr/lib/python2.7/logging/config.py", line 575, in configure '%r: %s' % (name, e)) ValueError: Unable to configure handler 'logentries_handler': expected string or buffer
當Django管理命令在Dotcloud中作爲cron作業運行時,logentries失敗
這是在腳本中的一個從cron運行 -
#!/bin/bash
echo "Loading definitions - check /var/log/supervisor/availsserver.log for results"
. /etc/profile
/home/dotcloud/env/bin/python /home/dotcloud/current/my_project/manage.py load_definitions
這些都是我的設置Logentries -
'logentries_handler': { 'token': os.getenv("LOGENTRIES_TOKEN"), 'class': 'logentries.LogentriesHandler' } .... 'logentries': { 'handlers': ['logentries_handler'], 'level': 'INFO', },
的LOGENTRIES_TOKEN是存在的,當我做dotcloud env list
。
這是症狀的總結 -
- Logentries記錄從現場工作中正常使用。
- 如果我手動運行腳本 - dotcloud run www ~/current/scripts/load_definitions.sh
它的作品。
- 如果我從我的settings.py
中刪除Logentries設置,則cron作業有效。
- 如果Logentries項在我settings.py
我花了幾個小時試圖找到一個解決方案的cron作業失敗。誰能幫忙?
這沒有幫助。 – jensontech