|
From: Andy T. <an...@ha...> - 2001-12-14 04:13:21
|
Kevin Altis wrote:
>> From: Andy Todd [mailto:an...@ha...]
>>
>>> I also changed the path returned by getLogFileName to always use
>>> the application directory (sys.argv[0]) to avoid log files
>>> being
>>>
>> created in many
>>
>>> different directories while the app is running.
>>>
>>
>> Err, could we make that a default which can be overrided? I would
suggest
>> that if the specified log file name is a simple file name 'xxx.yyy'
>> you prepend the application directory, otherwise use whatever is
>> supplied (be it an absolute or relative path). I try and avoid writing
>> log files to my application directories.
>>
>
> How about this?
>
> def getLogFileName( self ) : # KEA 2001-12-13 # return the
> application path for the log file directory # unless the user
> supplied filename contains a directory path =
> os.path.split(self.getOption('logfile'))[0] if path == '': return
> os.path.abspath( \ os.path.join( \ os.path.dirname(sys.argv[0]), \
self.getOption('logfile')))
>
> else: return os.path.abspath(self.getOption('logfile'))
>
> That's checked into cvs and appears to work. I tried these settings
> in my pythoncard_user_config.py file:
>
> 'logfile':'c:\\temp\\pythoncard.log', 'logToStdout':0,
>
> ka
>
>
Looks good to me. Works on both *nix and Win32 when I tested it, with
absolute and relative paths too. I love os.path ;-)
Whilst I'm thinking about this, do we want to restrict ourselves to just
one log file per application? I'm trying to think of occasions when I've
needed more than one, and haven't come up with any - yet. Just in case
though, and if it isn't going to be too hard to support, perhaps we
could allow for multiple concurrent log files.
Just-thinking-out-loud-ly y'rs,
Andy
--
-----------------------------------------------------------------------
From the desk of Andrew J Todd esq.
"Another year older, still no wiser." - Me, on my birthday
|