Edgewall Software
Modify

Opened 16 years ago

Closed 16 years ago

#7296 closed defect (wontfix)

initenv fails when default log_type set to file

Reported by: volker@… Owned by: Jonas Borgström
Priority: normal Milestone:
Component: general Version: 0.11rc1
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Changing log_type in /usr/lib/python2.5/site-packages/trac/env.py from none to file to have trac.ini created with locally better suited defaults fails with:

Failed to create environment. [Errno 2] No such file or directory: u'/srv/trac/projects/test/log/trac.log'

Details:

# trac-admin /srv/trac/projects/test initenv Creating a new Trac environment at /srv/trac/projects/test

Trac will first ask a few questions about your environment in order to initalize and prepare the project database.

Please enter the name of your project. This name will be used in page titles and descriptions.

Project Name [My Project]>

Please specify the connection string for the database to use. By default, a local SQLite database is created in the environment directory. It is also possible to use an already existing PostgreSQL database (check the Trac documentation for the exact connection string syntax).

Database connection string db/trac.db>

Please specify the type of version control system, By default, it will be svn.

If you don't want to use Trac with version control integration, choose the default here and don't specify a repository directory. in the next question.

Repository type [svn]>

Please specify the absolute path to the version control repository, or leave it blank to use Trac without a repository. You can also set the repository location later.

Path to repository path/to/repos>

Creating and Initializing Project Failed to create environment. [Errno 2] No such file or directory: u'/srv/trac/projects/test/log/trac.log' Traceback (most recent call last):

File "/usr/lib/python2.5/site-packages/trac/admin/console.py", line 543, in do_initenv

options=options)

File "/usr/lib/python2.5/site-packages/trac/env.py", line 173, in init

self.setup_log()

File "/usr/lib/python2.5/site-packages/trac/env.py", line 362, in setup_log

format=format)

File "/usr/lib/python2.5/site-packages/trac/log.py", line 27, in logger_factory

hdlr = logging.FileHandler(logfile)

File "/usr/lib/python2.5/logging/init.py", line 770, in init

stream = open(filename, mode)

IOError: [Errno 2] No such file or directory: u'/srv/trac/projects/test/log/trac.log' Exit 1

Attachments (0)

Change History (4)

comment:1 by Noah Kantrowitz, 16 years ago

Resolution: wontfix
Status: newclosed

So you changed the code, and it broke, and you are filing this as a bug? The first time the env is opened, the log/ folder doesn't even exist.

comment:2 by ebray <hyugaricdeau@…>, 16 years ago

Resolution: wontfix
Status: closedreopened

Though I agree with nkantrowitz above, I'll add that I've encountered this as well, and it happens even without modifying the code. It can also happen if the inherited global trac.ini has log_type set to file. This is because Environment.setup_log() is called before Environment.create() even if the environment doesn't exist yet. So this might still be an issue.

Currently I deal with this by having my environment setup script manually create the log/ directory and set the correct permissions on it.

comment:3 by Volker <volker@…>, 16 years ago

I did not change the code, I changed the default values with which trac.ini is initialised. I see that as a difference.

Creating the directory first and touching the log file is hopeless because then trac-admin complains that the directory already exists and that it is non-empty.

comment:4 by Noah Kantrowitz, 16 years ago

Resolution: wontfix
Status: reopenedclosed

No, this cannot happen using the --inherit option. The first time the env is loaded, the logging is initialized before the inherited file is processed. The only way for this to happen is to alter the default value in the option descriptor. Don't do that.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.