Modify

Opened 13 years ago

Last modified 11 years ago

#8919 new enhancement

Relative path name to Log file

Reported by: anonymous Owned by: izzy
Priority: low Component: LogViewerPlugin
Severity: minor Keywords:
Cc: Trac Release: 0.11

Description

I've compiled this plugin to work with 0.12 and it is working so far. The only issue that arose is a relative path name specified for the log file brings up an IOError.

Setting the logfile path name to an absolute path seems to be working now.

Attachments (0)

Change History (1)

comment:1 Changed 11 years ago by izzy

I've just checked, and my trac.ini has a very relative path (none to be true: log_file = trac.log). In this case, LogViewer takes the path to the project from the environment, and adds a log to it.

What you could try (and let me know if it works): in api.py after line 16, please insert:

if fpath and not os.path.exists(fpath): name = os.path.join(self.env.path,fpath,name)

To give you the context:

fpath, fname = os.path.split(name)
if not fpath: name = os.path.join(self.env.path,'log',name)
if fpath and not os.path.exists(fpath): name = os.path.join(self.env.path,fpath,name)
if not os.path.exists(name): raise IOError

So that should do:

  • if not fpath: if only a file name is given, look for it in the log subdirectory of the project's Trac environment
  • if fpath and not os.path.exists(fpath): if there was a path specified which does not exist, assume it's relative to the project's path

Please let me know whether that worked out. And sorry that it took me so long to respond!

Last edited 11 years ago by izzy (previous) (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain izzy.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.