Opened 6 years ago

# Relative path name to Log file

Reported by: Owned by: anonymous izzy low LogViewerPlugin minor 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.

### comment:1 Changed 3 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 3 years ago by izzy (previous) (diff)

### Modify Ticket

Change Properties