'Sets the target file for all logging output.
Works in a similar fashion to :attr:`log_level`.
Examples:
>>> context.log_file = \'foo.txt\' #doctest: +ELLIPSIS
>>> log.debug(\'Hello!\') #doctest: +ELLIPSIS
>>> with context.local(log_level=\'ERROR\'): #doctest: +ELLIPSIS
...     log.info(\'Hello again!\')
>>> with context.local(log_file=\'bar.txt\'):
...     log.debug(\'Hello from bar!\')
>>> log.info(\'Hello from foo!\')
>>> file(\'foo.txt\').readlines()[-3] #doctest: +ELLIPSIS
\'...:DEBUG:...:Hello!\n\'
>>> file(\'foo.txt\').readlines()[-2] #doctest: +ELLIPSIS
\'...:INFO:...:Hello again!\n\'
>>> file(\'foo.txt\').readlines()[-1] #doctest: +ELLIPSIS
\'...:INFO:...:Hello from foo!\n\'
>>> file(\'bar.txt\').readlines()[-1] #doctest: +ELLIPSIS
\'...:DEBUG:...:Hello from bar!\n\''

@_validator
def log_file(self, value):

    if isinstance(value, (str, unicode)):
        modes = ('w', 'wb', 'a', 'ab')
        if (',' not in value):
            value += ',a'
        (filename, mode) = value.rsplit(',', 1)
        value = open(filename, mode)
    elif (not isinstance(value, file)):
        raise AttributeError('log_file    must    be    a    file')
    if (self.log_file and (not isinstance(self.log_file, _devnull))):
        a = os.fstat(value.fileno()).st_ino
        b = os.fstat(self.log_file.fileno()).st_ino
        if (a == b):
            return self.log_file
    iso_8601 = '%Y-%m-%dT%H:%M:%S'
    lines = [('=' * 78), ('    Started    at    %s    ' % time.strftime(iso_8601)), '    sys.argv    =    [']
    for arg in sys.argv:
        lines.append(('            %r,' % arg))
    lines.append('    ]')
    lines.append(('=' * 78))
    for line in lines:
        value.write(('=%-78s=\n' % line))
    value.flush()
    return value
