Appeds to the logfile. The logfile is relative to the logs directory.
If the logfile doesn't exist yet the system will create it. The '.log'
extention is automatically appended, along with a single
newline character.
972284
protected function appendToFile($logfile, $logstring, $explicit = false) {

		$class = \hlin\PHP::unn(__CLASS__);

		# logging signatures are intended to prevent duplication PER REQUEST
		# on a per logger instance basis, not cull duplicate messages per log

		$sig = crc32($logstring);
		$filesig = crc32($sig.$logfile);

		// have we already logged the message?
		if ( ! in_array($filesig, $this->filesigs)) {

			$fs = $this->fs;
			$filepath = $this->logspath.'/'.$logfile.'.log';
			$dir = $fs->dirname($filepath);

			if ( ! $fs->file_exists($dir)) {
				if ( ! $fs->mkdir($dir, $this->dirPermission(), true)) {
					$this->failedLogging(null, "[$class] Failed to create directories: $dir");
					return;
				}
			}

			// does the file exist?
			if ( ! $fs->file_exists($filepath)) {
				// ensure the file exists
				if ( ! $fs->touch($filepath)) {
					$this->failedLogging(null, "[$class] Failed to create log file: $filepath");
					return;
				}
				// ensure the permissions are right
				if ( ! $fs->chmod($filepath, $this->filePermission())) {
					$this->failedLogging(null, "[$class] Failed to set permissions on log file: $filepath");
					return;
				}
			}

			if ( ! $fs->file_append_contents($filepath, "$logstring\n")) {
				$this->failedLogging(null, "[$class] Failed to append to log: $filepath");
			}

			// intentionally recording signature only after success
			$this->filesigs[] = $filesig;

			// have we stored the summary report?
			if ( ! $explicit && ! in_array($sig, $this->sigs)) {

				$filepath = $this->logspath.'/summary.log';

				# we don't need to ensure directory structure; it's already
				# been ensured by previous operations of recording the long
				# term complete log message

				// we only record the first line in the summary log
				if (($ptr = stripos($logstring, "\n")) !== false) {
					$summary = trim(substr($logstring, 0, $ptr));
				}
				else { // no end of line detected
					$summary = trim($logstring);
				}

				if ( ! $fs->file_append_contents($filepath, "$summary\n")) {
					$this->failedLogging(null, "[$class] Failed to append to log: $filepath");
				}

				// intentionally recording signature only after success
				$this->sigs[] = $sig;
			}
		}
	}
1117857
function logfile(val) {
  var fd;
  // empty string disables use of log file
  if(val) {
    try {
      fd = fs.openSync(val, 'a');
      fs.closeSync(fd);
    }catch(e) {
      throw new Error(util.format('Can\'t open the log file: %s', val));
    }
  }
}
1276639
private void configureWithWrapperWritingToFile(LoggerContext ctx) {
    // configure all logs (ie. root logger) to be written to console with formatting
    // in practice, this will be only APP's own logs as logs from sub processes are written to LOGGER_GOBBLER and
    // LOGGER_GOBBLER is configured below to be detached from root
    // logs are written to the console because we want them to be in sonar.log and the wrapper will write any log
    // from APP's System.out and System.err to sonar.log
    Logger rootLogger = ctx.getLogger(ROOT_LOGGER_NAME);
    rootLogger.addAppender(createAppConsoleAppender(ctx, helper.buildLogPattern(APP_ROOT_LOGGER_CONFIG)));

    // in regular configuration, sub processes are not copying their logs to their System.out, so, the only logs to be
    // expected in LOGGER_GOBBLER are those before logback is setup in subprocesses or when JVM crashes
    // so, they must be printed to App's System.out as is (as they are already formatted) and the wrapper will write
    // them to sonar.log
    // logger is configured to be non additive as we don't want these logs written to sonar.log and duplicated in the
    // console with an incorrect formatting
    configureGobbler(ctx);
  }
913104
private synchronized void setFile()
        throws IOException
    {
        // Check directory
        File file = new File(_filename);
        _filename=file.getCanonicalPath();
        file=new File(_filename);
        File dir= new File(file.getParent());
        if (!dir.isDirectory() || !dir.canWrite())
            throw new IOException("Cannot write log directory "+dir);
            
        Date now=new Date();
        
        // Is this a rollover file?
        String filename=file.getName();
        int i=filename.toLowerCase().indexOf(YYYY_MM_DD);
        if (i>=0)
        {
            file=new File(dir,
                          filename.substring(0,i)+
                          _fileDateFormat.format(now)+
                          filename.substring(i+YYYY_MM_DD.length()));
        }
            
        if (file.exists()&&!file.canWrite())
            throw new IOException("Cannot write log file "+file);

        // Do we need to change the output stream?
        if (out==null || !file.equals(_file))
        {
            // Yep
            _file=file;
            if (!_append && file.exists())
                file.renameTo(new File(file.toString()+"."+_fileBackupFormat.format(now)));
            OutputStream oldOut=out;
            out=new FileOutputStream(file.toString(),_append);
            if (oldOut!=null)
                oldOut.close();
            if(log.isDebugEnabled())log.debug("Opened "+_file);
        }
    }
229015
function (config) {
    config = config || {};
    Appender.call(this, config);

    /**
     * Log file name, initialized from the configuration. Folders up to the
     * file must exist beforehand.
     */
    this.fileName = config.fileName;

    /**
     * Append log events to the end of the file when true, clear the file
     * before writing the first log event otherwise.
     */
    this.appendToFile = (typeof config.append !== 'undefined') ?
      !!config.append :
      true;

    /**
     * True to log strings instead of objects
     */
    this.appendStrings = (typeof config.appendStrings !== 'undefined') ?
      config.appendStrings :
      true;

    /**
     * The file stream, initialized by the "start" function
     */
    this.stream = null;
  }
267038
@Override
    public String logFile() {
        if(logFile == null) {
            logFile = Config.getTmpDir()+Config.getPathSeparator()+"aesh.log";
        }
        return logFile;
    }
567865
def open_logfile(filename, mode='a'):
    
    filename = os.path.expanduser(filename)
    filename = os.path.abspath(filename)
    dirname = os.path.dirname(filename)
    if not os.path.exists(dirname):
        os.makedirs(dirname)
    exists = os.path.exists(filename)

    log_fp = open(filename, mode)
    if exists:
        log_fp.write('%s\n' % ('-'*60))
        log_fp.write('%s run on %s\n' % (sys.argv[0], time.strftime('%c')))
    return log_fp
553083
function logFile(options){
  var message   = options.message,
      file      = options.file,
      stat      = options.stat,
      extraText = options.extraText,
      logger    = options.logger;

  if (!file || !file.relative || (stat && stat.isDirectory())) {
    return;
  }
  var fileName = gutil.colors.magenta(file.relative);
  if (extraText) {
    logger(message, fileName, extraText);
  } else {
    logger(message, fileName);
  }
}
516176
def log(self, logfile=None):
        """"""
        if logfile is None:
            logfile = sys.stderr
        tb = self.plaintext.rstrip() + '\n'

        file_mode = getattr(logfile, 'mode', None)
        if file_mode is not None:
            if 'b' in file_mode:
                tb = tb.encode('utf-8')
            logfile.write(tb)
1142634
public static void saveLogFile(String logPath, String content) throws IOException {
        File file = new File(logPath);
        if (file.exists()) {
            content += readFile(file);
        }
        saveFile(file, content);
    }
1322463
def add_line_if_absent(filename: str, line: str) -> None:
    
    assert "\n" not in line
    if not is_line_in_file(filename, line):
        log.info("Appending line {!r} to file {!r}", line, filename)
        with open(filename, "a") as file:
            file.writelines([line])
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')
1040573
def log2file(filename = File.basename($0) + '.todo', level = Log4r::ALL)
      @logger.add( Log4r::FileOutputter.new('ToDo', 
                                      :filename => filename,
                                      :level => level,
                                      :formatter => FixmeFormatter 
                                    ))
      
    end
1289813
public void setLogger(Logger logger) {

		System.out.println("LOGGER set");
//		if(logger instanceof SimpleFileLogger) {
			this.logger = logger;
			System.out.println("appender added");
			this.logger.addAppender(this);
//		}
	}
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)
896356
private function initializeLogFile()
    {
        $this->log = $this->dir.'/builds.log';

        if (!file_exists($this->log)) {
            $data = array(
                'last_update' => null,
                'projects'    => array(),
            );

            file_put_contents($this->log, serialize($data));
        }
    }
247744
private void handleLogfile() {
        if (args.logFile != null) {
            FileUtils.close(out);
            FileUtils.close(err);
        }
    }