Modifies logging statements in the specified file.
339664
def modify_logging(input_fn, output_fn, min_level_value, max_level_value, restore, force):
    """"""
    # read in all the lines
    logging.info('reading in %s' % input_fn)
    fh = open(input_fn, 'r')
    lines = fh.readlines()
    fh.close()
    original_contents = ''.join(lines)

    if restore:
        forwards = restore_logging
        backwards = disable_logging
    else:
        forwards = disable_logging
        backwards = restore_logging

    # apply the requested action
    new_contents = forwards(lines, min_level_value, max_level_value)

    # quietly check to see if we can undo what we just did (if not, the text
    # contains something we cannot translate [bug or limitation with this code])
    logging.disable(logging.CRITICAL)
    new_contents_undone = backwards(new_contents.splitlines(True), min_level_value, max_level_value)
    logging.disable(logging.DEBUG)
    if original_contents != new_contents_undone:
        base_str = 'We are unable to revert this action as expected'
        if force:
            logging.warning(base_str + " but -f was specified so we'll do it anyway.")
        else:
            logging.error(base_str + ', so we will not do it in the first place.  Pass -f to override this and make the change anyway.')
            return -1

    logging.info('writing the new contents to %s' % output_fn)
    fh = open(output_fn, 'w')
    fh.write(new_contents)
    fh.close()
    logging.info('done!')
    return 0
9212
protected function updateLogFile()
    {
        // update file. $dtStr is '_Y-m-d' or '_Y-m-d_H'
        if ($this->fileIsChanged()) {
            fclose($this->fileHandle);

            $logFile = $this->genLogFile(true);
            $this->file = $logFile;
            $this->fileHandle = @fopen($logFile, 'ab');

            if (!$this->fileHandle) {
                $this->stderr("Could not open the log file {$logFile}");
            }
        }
    }
328964
public static void fixLoggingSystem(File basedir) {
        ILoggerFactory factory = LoggerFactory.getILoggerFactory();
        if (factory instanceof LoggerContext) {
            // We know that we are using logback from here.
            LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
            ch.qos.logback.classic.Logger logbackLogger = lc.getLogger(Logger.ROOT_LOGGER_NAME);
            if (logbackLogger == null) {
                return;
            }

            Iterator<Appender<ILoggingEvent>> iterator = logbackLogger.iteratorForAppenders();
            while (iterator.hasNext()) {
                Appender<ILoggingEvent> appender = iterator.next();

                if (appender instanceof AsyncAppender) {
                    appender = ((AsyncAppender) appender).getAppender("FILE");
                }

                if (appender instanceof RollingFileAppender) {
                    RollingFileAppender<ILoggingEvent> fileAppender =
                            (RollingFileAppender<ILoggingEvent>) appender;
                    String file = new File(basedir, "logs/wisdom.log").getAbsolutePath();
                    fileAppender.stop();
                    // Remove the created log directory.
                    // We do that afterwards because on Windows the file cannot be deleted while we still have a logger
                    // using it.
                    FileUtils.deleteQuietly(new File("logs"));
                    fileAppender.setFile(file);
                    fileAppender.setContext(lc);
                    fileAppender.start();
                }
            }
        }
    }
65389
protected void logEntityModification(EntityIdValue entityId,
			List<Statement> updateStatements, String propertyId) {
		modifiedEntities++;
		modifiedStatements += updateStatements.size();
		modifiedStatementsByProperty.put(
				propertyId,
				modifiedStatementsByProperty.get(propertyId)
						+ updateStatements.size());

		System.out.println(entityId.getId() + ": fixing "
				+ updateStatements.size() + " statement(s) for " + propertyId
				+ " (" + modifiedEntities + " entities modified so far)");

		this.logfile.println("\n==" + entityId.getId() + "==\n"
				+ updateStatements.toString());

		if (modifiedEntities % 10 == 0) {
			this.logfile.flush();
			System.out.println("### " + modifiedStatements
					+ " statements modified so far: "
					+ modifiedStatementsByProperty.toString());
		}
	}
201482
def do_set_log_file(self, args):
        
        params = args.split()
        try:
            filename = params[0]
            logging.basicConfig(filename=filename)
        except IndexError:
            self.do_help('set_log_file')
1373632
def clear_logfile(logfile):
    
    try:
        os.remove(logfile + '_out.txt')
    except IOError:
        pass
    try:
        os.remove(logfile + '_err.txt')
    except IOError:
        pass
143441
def _setup_logger(self, level, log_file):
        """"""
        if logger.handlers:
            return
        level = getattr(logging, level.upper())
        logger.setLevel(level)
        formatter = logging.Formatter(
            '[%(levelname)s] %(asctime)s - %(module)s.%(funcName)s() - %(message)s')
        handler = logging.StreamHandler()
        logger.addHandler(handler)
        handler.setFormatter(formatter)
        if not log_file:
            return
        try:
            handler = TimedRotatingFileHandler(log_file)
        except IOError:
            logger.error("Could not write to %s, falling back to stdout",
                         log_file)
        else:
            logger.addHandler(handler)
            handler.setFormatter(formatter)
528931
def update_log_filenames(self):
        """"""
        log_filenames = os.listdir(self.logs_dir)

        for log_filename in log_filenames:
            full_path = os.path.join(self.logs_dir, log_filename)
            if full_path not in self.log_filenames:
                self.log_filenames.add(full_path)
                self.closed_file_infos.append(
                    LogFileInfo(
                        filename=full_path,
                        size_when_last_opened=0,
                        file_position=0,
                        file_handle=None))
                logger.info("Beginning to track file {}".format(log_filename))
1005309
public void onFileChange(File file) {
        LOG.info("File updated : {}", file.getAbsolutePath());
        onFileDelete(file);
        onFileCreate(file);
    }
1264829
def add_release_to_changelog(version):
    """"""
    temp_file = changelog_file().parent / ("~" + changelog_file().name)
    now = datetime.today()
    release_added = False
    with open(str(temp_file), 'w') as g:
        with open(str(changelog_file()), 'r') as f:
            for line in f:
                list_match = list_match_re.match(line)
                if list_match and not release_added:
                    release_line = "{}{} :release:`{} <{}-{:02}-{:02}>`".format(
                                        list_match.group("leading"),
                                        list_match.group("mark"),
                                        version, now.year, now.month, now.day)
                    print(release_line, file=g)
                    release_added = True
                print(line, file=g, end="")
            if not release_added:
                release_line = "{}{} :release:`{} <{}-{:02}-{:02}>`".format(
                                " ", "-", version, now.year, now.month, now.day)
                print(release_line, file=g)
        print('', file=g)  # add a blank line at the end of the file
    shutil.copyfile(str(temp_file), str(changelog_file()))
    os.remove(str(temp_file))
1113350
public void addChangelogFile(File changelogFile) throws IOException, ChangelogParseException {
		new ChangelogHandler(this.format.getHeader()).addChangeLog(changelogFile);
	}
394009
def configure_logging():
  """"""

  # Define the top-level logger.
  htf_logger = logging.getLogger(LOGGER_PREFIX)
  htf_logger.propagate = False
  htf_logger.setLevel(logging.DEBUG)

  # By default, don't print any logs to the CLI.
  if CLI_LOGGING_VERBOSITY == 0:
    htf_logger.addHandler(logging.NullHandler())
    return

  if CLI_LOGGING_VERBOSITY == 1:
    logging_level = logging.INFO
  else:
    logging_level = logging.DEBUG

  # Configure a handler to print to the CLI.
  cli_handler = KillableThreadSafeStreamHandler(stream=sys.stdout)
  cli_handler.setFormatter(CliFormatter())
  cli_handler.setLevel(logging_level)
  cli_handler.addFilter(MAC_FILTER)
  htf_logger.addHandler(cli_handler)

  # Suppress CLI logging if the --quiet flag is used, or while CLI_QUIET is set
  # in the console_output module.
  cli_handler.addFilter(console_output.CliQuietFilter())
1020902
def _fix_file(parameters):
    """"""
    if parameters[1].verbose:
        print('[file:{0}]'.format(parameters[0]), file=sys.stderr)
    try:
        fix_file(*parameters)
    except IOError as error:
        print(unicode(error), file=sys.stderr)
1277848
public void setLog(String dataDirectory, boolean enablePurgeBySize, boolean enablePurgeByTime, long maxSize  , long minPurgeTime,
		String outOfSpaceAction, boolean enableBuffering, boolean fileSwitchEnabled, int fileSwitchTime){
		LogState state = ivLog.clone();
		state.ivDataDirectory = dataDirectory;
		state.ivPurgeBySizeEnabled = enablePurgeBySize ;
		state.ivPurgeByTimeEnabled = enablePurgeByTime ;
		state.ivPurgeMaxSize = maxSize;
		state.ivPurgeMinTime = minPurgeTime;
		state.ivOutOfSpaceAction = outOfSpaceAction;
		state.ivBufferingEnabled = enableBuffering ;
		state.ivFileSwitchEnabled = fileSwitchEnabled ;
		state.ivFileSwitchTime = fileSwitchTime ;

		updateLogConfiguration(state);
		
		state.copyTo(ivLog);
	}
1267244
private void resetFile(String file) {
    File f = new File(file);
    if (f.exists()) {
      JMetalLogger.logger.info("Already existing file " + file);

      if (f.isDirectory()) {
        JMetalLogger.logger.info("Deleting directory " + file);
        if (f.delete()) {
          JMetalLogger.logger.info("Directory successfully deleted.");
        } else {
          JMetalLogger.logger.info("Error deleting directory.");
        }
      } else {
        JMetalLogger.logger.info("Deleting file " + file);
        if (f.delete()) {
          JMetalLogger.logger.info("File successfully deleted.");
        } else {
          JMetalLogger.logger.info("Error deleting file.");
        }
      }
    } else {
      JMetalLogger.logger.info("File " + file + " does NOT exist.");
    }
  }
923902
public function update_logging()
    {
        $config = $this->app->make('config');
        if (!$this->token->validate('update_logging')) {
            $this->error->add($this->token->getErrorMessage());
        }
        if ($this->request->request->get('handler') == 'file' && $this->request->request->get('logging_mode')) {
            $logFile = $this->request->request->get('logFile');
            $filesystem = new Filesystem();
            $directory = dirname($logFile);
            if ($filesystem->isFile($logFile) && !$filesystem->isWritable($logFile)) {
                $this->error->add(t('Log file exists but is not writable by the web server.'));
            }
            if (!$filesystem->isFile($logFile) && (!$filesystem->isDirectory($directory) || !$filesystem->isWritable($directory))) {
                $this->error->add(t('Log file does not exist on the server. The directory of the file provided must exist and be writable on the web server.'));
            }
            $filename = basename($logFile);
            if (!$filename || substr($filename, -4) != '.log') {
                $this->error->add(t('The filename provided must be a valid filename and end with .log'));
            }
        }
        if (!$this->error->has()) {
            $intLogErrorsPost = $this->post('ENABLE_LOG_ERRORS') == 1 ? 1 : 0;
            $intLogEmailsPost = $this->post('ENABLE_LOG_EMAILS') == 1 ? 1 : 0;

            $config->save('concrete.log.errors', $intLogErrorsPost);
            $config->save('concrete.log.emails', $intLogEmailsPost);

            $mode = $this->request->request->get('logging_mode');
            if ($mode != 'advanced') {
                $mode = 'simple';
                $config->save('concrete.log.configuration.simple.core_logging_level',
                    $this->request->request->get('logging_level')
                );
                $config->save('concrete.log.configuration.simple.handler',
                    $this->request->request->get('handler')
                );
                $config->save('concrete.log.configuration.simple.file.file',
                    $this->request->request->get('logFile')
                );
            }
            $config->save('concrete.log.enable_dashboard_report',
                $this->request->request->get('enable_dashboard_report') ? true : false);
            $config->save('concrete.log.configuration.mode', $mode);

            $this->redirect('/dashboard/system/environment/logging', 'logging_saved');
        }
        $this->view();
    }
323632
def edit_file(self, filename, line):
        """"""
        if encoding.is_text_file(filename):
            # The default line number sent by ipykernel is always the last
            # one, but we prefer to use the first.
            self.edit_goto.emit(filename, 1, '')