Specify logfile path
511210
def set_logfile(path, instance):
    """"""

    global logfile
    logfile = os.path.normpath(path) + '/hfos.' + instance + '.log'
969372
private Path getTaskLogFileFromId(String taskId)
  {
    return new Path(mergePaths(config.getDirectory(), taskId.replace(':', '_')));
  }
448682
def setup_logging():
    
    default_path_yaml = os.path.expanduser('~/.pylogconf.yaml')
    default_path_conf = os.path.expanduser('~/.pylogconf.conf')
    # this matches the default logging level of the logging
    # library and makes sense...
    default_level = logging.WARNING

    dbg = os.getenv("PYLOGCONF_DEBUG", False)

    """ try YAML config file first """
    value = os.getenv('PYLOGCONF_YAML', None)
    if value is None:
        path = default_path_yaml
    else:
        path = value
    if os.path.isfile(path):
        _debug('found logging configuration file [{0}]...'.format(path), dbg)
        with open(path) as f:
            config = yaml.load(f.read())
            logging.config.dictConfig(config)
            return

    """ Now try regular config file """
    value = os.getenv('PYLOGCONF_CONF', None)
    if value is None:
        path = default_path_conf
    else:
        path = value
    if os.path.isfile(path):
        _debug('found logging configuration file [{0}]...'.format(path), dbg)
        logging.config.fileConfig(path)
        return

    _debug('logging with level [{0}]...'.format(default_level), dbg)
    logging.basicConfig(level=default_level)
1090099
def start_file_logger(self, name, log_file_level=logging.DEBUG, log_file_path='./'):
        """"""

        log_file_path = os.path.expanduser(log_file_path) / '{}.log'.format(name)
        logdir = log_file_path.parent

        try:
            logdir.mkdir(parents=True, exist_ok=True)

            # If the log file exists, backs it up before creating a new file handler
            if log_file_path.exists():
                strtime = datetime.datetime.utcnow().strftime('%Y-%m-%d_%H:%M:%S')
                shutil.move(log_file_path, log_file_path + '.' + strtime)

            self.fh = TimedRotatingFileHandler(str(log_file_path), when='midnight', utc=True)
            self.fh.suffix = '%Y-%m-%d_%H:%M:%S'
        except (IOError, OSError) as ee:
            warnings.warn('log file {0!r} could not be opened for writing: '
                          '{1}'.format(log_file_path, ee), RuntimeWarning)
        else:
            self.fh.setFormatter(fmt)
            self.addHandler(self.fh)
            self.fh.setLevel(log_file_level)

        self.log_filename = log_file_path
1197287
def get_log_dir(self, conf_file):
        
        log_dir = None

        with open(conf_file, 'r') as conf_f:
            for line in conf_f:
                line = line.split('#')[0].strip()

                try:
                    (key, value) = line.split('=', 1)
                    if key.strip() == 'log-dir':
                        log_dir = value.strip()
                except ValueError:
                    pass

        return log_dir
1036427
def set_log_file_extension(self, logFileExtension):
        
        assert isinstance(logFileExtension, basestring), "logFileExtension must be a basestring"
        assert len(logFileExtension), "logFileExtension can't be empty"
        if logFileExtension[0] == ".":
            logFileExtension = logFileExtension[1:]
        assert len(logFileExtension), "logFileExtension is not allowed to be single dot"
        if logFileExtension[-1] == ".":
            logFileExtension = logFileExtension[:-1]
        assert len(logFileExtension), "logFileExtension is not allowed to be double dots"
        self.__logFileExtension = logFileExtension
        # set log file name
        self.__set_log_file_name()
612347
def create_log(log_file, uid):
    
    if not os.path.exists(log_file):  # create new log file
        dir_name = os.path.dirname(log_file)
        if not os.path.exists(dir_name):
            os.makedirs(dir_name, 0755)
            os.chown(dir_name, uid, -1)

        with open(log_file, "w") as f:
            f.write("")

    os.chown(log_file, uid, -1)
    os.chmod(log_file, 0640)
1275345
def log_head(path, log_file, log_time):
    
    with open(path + log_file, "w") as log:
        log.write("#" * 79 + "\n\n")
        log.write("File : " + log_file + "\n")
        log.write("Path : " + path + "\n")
        log.write("Date : " + time.strftime("%d/%m/%Y") + "\n")
        log.write("Time : " + log_time + "\n\n")
        log.write("#" * 79 + "\n\n")
        log.close()
936486
def log_path(scraper):
    
    return os.path.join(scraper.config.data_path,
                        '%s.jsonlog' % scraper.name)
1322781
def logging_file_install(path):
    
    if path is None:
        path = configuration_get_default_folder() / LOGGING_DEFAULTNAME

    if not path.parent.exists():
        log.error('File logger installation FAILED!')
        log.error('The directory of the log file does not exist.')
        return

    formatter = logging.Formatter(LOGGING_FORMAT)
    logger = logging.getLogger()

    logger.removeHandler(LOGGING_HANDLERS['file'])

    logFileHandler = logging.handlers.RotatingFileHandler(filename=str(path),
                                                          mode='a',
                                                          maxBytes=LOGGING_MAXBYTES,
                                                          backupCount=LOGGING_BACKUPCOUNT)
    logFileHandler.setLevel(logging.DEBUG)
    logFileHandler.setFormatter(formatter)

    LOGGING_HANDLERS['file'] = logFileHandler

    logger.addHandler(logFileHandler)
1169411
def _add_log_file(filename):
    """"""
    handler = logging.FileHandler(filename)

    handler.setLevel(logging.DEBUG)
    formatter = _Formatter(fmt=_logger_fmt,
                           datefmt='%Y-%m-%d %H:%M:%S')
    handler.setFormatter(formatter)
    logging.getLogger().addHandler(handler)
785155
public function setLogFile($logFile)
    {
        if (strpos($logFile, '://') === false) {
            if (!GeneralUtility::isAbsPath($logFile)) {
                $logFile = PATH_site . $logFile;
            }
        }

        $this->logFile = $logFile;
        $this->openLogFile();

        return $this;
    }
123427
public function getLogPath(): string
    {
        $path = $this->getRuntimePath() . DIRECTORY_SEPARATOR . 'logs';
        FileHelper::createDirectory($path);
        return $path;
    }
1211542
def log_file(self):
        
        log_file = self.get('log')
        if not log_file:
            log_file = '%s.log' % (self.name)
            self.set('log', log_file)
        return os.path.join(self.initial_dir, self.get('log'))
1370621
private synchronized void checkPath(String logPath) throws ParameterException {
		Validate.notNull(path);
		File cPath = new File(logPath);
		if(!cPath.exists())
			cPath.mkdirs();
		if(!cPath.isDirectory())
			throw new ParameterException(ErrorCode.INCOMPATIBILITY, logPath + " is not a valid path!");
	}
864395
def _adjust_log_file_override(overrides, default_log_file):
    '''
    
    '''
    if overrides.get('log_dir'):
        # Adjust log_file if a log_dir override is introduced
        if overrides.get('log_file'):
            if not os.path.isabs(overrides['log_file']):
                # Prepend log_dir if log_file is relative
                overrides['log_file'] = os.path.join(overrides['log_dir'],
                                                     overrides['log_file'])
        else:
            # Create the log_file override
            overrides['log_file'] = \
                os.path.join(overrides['log_dir'],
                             os.path.basename(default_log_file))
391142
def log_path(cls, project, log):
        """"""
        return google.api_core.path_template.expand(
            "projects/{project}/logs/{log}", project=project, log=log
        )