Opened 19 years ago
Closed 19 years ago
#2498 closed defect (fixed)
Logging error with initenv
Reported by: | Manuzhai | Owned by: | daniel |
---|---|---|---|
Priority: | normal | Milestone: | 0.10 |
Component: | admin/console | Version: | devel |
Severity: | normal | Keywords: | |
Cc: | manuzhai@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
When there is a central trac.ini (in /etc) that enables logging to a file in the environment, initenv fails because it cannot find the file. Makes some sense, since it's looking for a directory that still has to be written, probably.
Failed to create environment. [Errno 2] No such file or directory: '/var/trac/life/log/trac.log' Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/trac/scripts/admin.py", line 570, in do_initenv options=options) File "/home/manuzhai/dev/trac/trac/env.py", line 78, in __init__ self.setup_log() File "/home/manuzhai/dev/trac/trac/env.py", line 232, in setup_log self.log = logger_factory(logtype, logfile, loglevel, logid) File "/home/manuzhai/dev/trac/trac/log.py", line 26, in logger_factory hdlr = logging.FileHandler(logfile) File "/usr/lib/python2.4/logging/__init__.py", line 753, in __init__ stream = open(filename, mode) IOError: [Errno 2] No such file or directory: '/var/trac/life/log/trac.log' Failed to initialize environment. 1 Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/trac/scripts/admin.py", line 574, in do_initenv sys.exit(1) SystemExit: 1
Attachments (2)
Change History (7)
comment:1 by , 19 years ago
Milestone: | → 0.10 |
---|
comment:2 by , 19 years ago
Version: | 0.9.2 → devel |
---|
comment:3 by , 19 years ago
I looked into this some more. I think I fixed the problem, but then trac-admin crashes with a seemingly unrelated exception, see below:
Creating and Initializing Project Failed to create environment. local variable 'connector' referenced before assignment Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/trac/scripts/admin.py", line 584, in do_initenv options=options) File "/usr/lib/python2.4/site-packages/trac/env.py", line 82, in __init__ self.create(options) File "/usr/lib/python2.4/site-packages/trac/env.py", line 193, in create DatabaseManager(self).init_db() File "/usr/lib/python2.4/site-packages/trac/db/api.py", line 52, in init_db connector, args = self._get_connector() File "/usr/lib/python2.4/site-packages/trac/db/api.py", line 77, in _get_connector if not connector: UnboundLocalError: local variable 'connector' referenced before assignment Failed to initialize environment. 1 Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/trac/scripts/admin.py", line 588, in do_initenv sys.exit(1) SystemExit: 1
I'll attach my "fix".
by , 19 years ago
Attachment: | patch-2498.2.diff added |
---|
Fix #2498 by delaying the database initialization.
comment:5 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
The patch didn't quite work for me since some things were still looking for the log before it was initialized. Instead in [3277] I made sure the default config options are loaded for new environments before setting up logging.
This is still here! Just ran into it again today.
Assigning to 0.10, as it shouldn't be too hard.