Saves data to local logs dir when syslog server is not available
@param string $log_dir The log dir the data is written to
@param string $log_type The log_type being written to
@return boolean If the data was written or not
186297
public function save($log_dir = '')
    {
        if (empty($log_dir)) {
            $log_dir = \ROOT . '/private/logs/syslog/';
        }

        if (!is_dir($log_dir)) {
            mkdir($log_dir, 0777, true);
        }

        return file_put_contents($log_dir . date('Y_m_d') . '.log',
                $this->message . "\n", \FILE_APPEND);
    }
643218
public static function write_log($chain, $type, $file="", $line=""){
        /*if(filesize(PATHAPP . 'logs/log.txt') > 100000){           
            $arch= fopen(PATHAPP . 'logs/log.txt', "w");
            fclose($arch); 
        }*/
        $arch = fopen(PATHAPP . 'logs/log-' . date('Y-m-d') . '.txt', "a+"); 
        if(ENOLA_MODE == 'HTTP'){
            fwrite($arch, "[".date("Y-m-d H:i:s.u")." ".filter_input(INPUT_SERVER, 'REMOTE_ADDR')." "." - $type ] ".$chain." - $file - $line \n");
        }else{
            fwrite($arch, "[".date("Y-m-d H:i:s.u")." MODE CLI "." - $type ] ".$chain." - $file - $line \n");
        }
        fwrite($arch, "---------- \n");
        fclose($arch);
    }
987734
private static function validLogLevel($type, $sub_type) {
    switch (self::$log_level) {
      default:
      case self::LOG_NONE:
        return FALSE;
      case self::LOG_ALL:
        return TRUE; // Log everything
      case self::LOG_ACTIONS:
        if (self::isAction($type, $sub_type)) {
          return TRUE; // Log actions
        }
        return FALSE;
    }
  }
103182
public static function save($message, $logFile = 'static.log', $logDir = 'data/logs')
    {
        if ($logFile === null) {
            // Useful for just Z-Ray logging
            return;
        }
        $logger = static::getInstance($logFile, $logDir);
        if (is_object($message) && $message instanceof LoggableObject) {
            $message = json_encode($message->acploLogMe());
        }
        $logger->debug($message);
    }
529483
static function log( $logline, $out = '' ) {
		// Output log line, no error checking to save performance
		// Send to descriptor or other stream if resource passed
		if( is_resource($out) && fwrite( $out, "$logline\n" ) ){
			return true;
		}
		// Log to specified file
		else if( $out && error_log( "$logline\n", 3, $out ) ){
			return $out;
		}
		// else default - probably apache error log
		else if( error_log( $logline, 0 ) ){
			$out = ini_get('error_log');
			return $out ? $out : true;
		}
		else {
			return false;
		}
	}
685638
@VisibleForTesting
	static void createUploadDir(final Path uploadDir, final Logger log, final boolean initialCreation) throws IOException {
		if (!Files.exists(uploadDir)) {
			if (initialCreation) {
				log.info("Upload directory {} does not exist. " + uploadDir);
			} else {
				log.warn("Upload directory {} has been deleted externally. " +
					"Previously uploaded files are no longer available.", uploadDir);
			}
			checkAndCreateUploadDir(uploadDir, log);
		}
	}
491933
public function log($msg,$log_path = null)
    {
        $option = [
            'type' => 'File',
            'file_size' => 2097152,
            'time_format' => 'c',
        ];
        if ($log_path) {
            $option['path'] = WX_API_PATH.'/../../log/wx/';
        }else{
            $option['path'] = $log_path;
        }
        \think\Log::init($option);
        \think\Log::record($msg);
    }
454476
def _write_log(self, log_type, log_time, message):
        
        timestamp = datetime.datetime.now().strftime(" %Y-%m-%d %H:%M:%S")
        log_entry = "[{}{}] {}".format(log_type, timestamp if log_time else "", message)
        if self._logger and callable(getattr(self._logger, self._logger_methods[log_type], None)):
            # Check for log handler (sends message only if _logger_no_prefix is True)
            getattr(
                self._logger,
                self._logger_methods[log_type],
                None
                )(message if self._logger_no_prefix else log_entry)
        elif self._log_file:
            # Otherwise write to file, if a file has been specified
            with open(self._log_file, 'a') as logfile:
                try:
                    logfile.write(unicode(log_entry + "\n"))
                except NameError: # `unicode` only works in Python 2
                    logfile.write(log_entry + "\n")
        else:
            # Otherwise, print to STDOUT
            print(log_entry)
1032695
public function checkDirectory(): bool
    {
        if ($this->directory == null) {
            throw new LoggerException('Log directory is not defined yet');
        }

        self::$directoryChecked = self::$directoryChecked ?: is_dir($this->directory);
        if (!self::$directoryChecked) {
            self::$directoryChecked = (bool) @mkdir($this->directory, 0644, true);
            if (self::$directoryChecked === false) {
                throw new LoggerException(sprintf('Cannot make directory, error[%s]',
                    error_get_last()['message'] ?? 'Unknown'));
            }
        }

        return self::$directoryChecked;
    }
126418
public void prettyPrintsReport(File logDir) throws Exception {
        if ((!logDir.exists()) || (!logDir.isDirectory())) {
            throw new Exception("Error: LOGDIR " + logDir.getAbsolutePath()
                    + " seems not a valid directory. ");
        }
        File html_logs_report_file = new File(logDir.getAbsolutePath()
                + File.separator + "report.html");
        prettyPrintsReport(logDir, html_logs_report_file);
    }
319251
public function setLogDir($dir)
    {
        $dir = str_replace("\\", "/", $dir);
        $dir = rtrim($dir, '/');
        
        $this->logDir = $dir;
    }
500562
public function createBlogDirectory($blog_dir)
	{
		@mkdir($blog_dir , 0777, true );
		$this->config = $this->configContent( $blog_dir );
		@mkdir( $this->config['dir']['post'], 0777, true );
		@mkdir( $this->config['dir']['page'], 0777, true );
		@mkdir( $this->config['dir']['site'], 0777, true );
		@mkdir( $this->config['dir']['asset'], 0777, true );
		@mkdir( $this->config['dir']['layout'], 0777, true );	
	}
1246348
public static void setLogDir(String dir) {
		try { 
			logDir = dir;
			for (Entry<Class<?>, Logger> en : loggers.entrySet()) {
				FileHandler fh = new FileHandler(logDir+File.separator+en.getKey().getSimpleName()+".log");
				fh.setFormatter(getFormatter(en.getValue(),true));
				en.getValue().addHandler(fh);
			}
		}
		catch (SecurityException e) { e.printStackTrace(); }
		catch (IOException e) { e.printStackTrace(); }  
	}
358105
public function getLogDir()
    {
        static $dir;
        if (empty($dir)) {
            $dir = $this->getOpenDir() . '/log/';

            if (!is_dir($dir)) {
                mkdir($dir, 0755, true);
            }
        }
        return $dir;
    }
536912
private function loadFileLogger($log_dir, $name)
    {
        $monolog = new Logger($name);

        $monolog->pushHandler(
            new StreamHandler($log_dir . '/bow.log', Logger::DEBUG)
        );

        $monolog->pushHandler(
            new FirePHPHandler()
        );

        return $monolog;
    }
148816
protected static function initLogDirectory () {
		//if (static::$logDirectoryInitialized) return;
		$sysCfgDebug = static::getSystemCfgDebugSection();
		$logDirConfiguredPath = isset($sysCfgDebug['logDirectory']) 
			? $sysCfgDebug['logDirectory'] 
			: static::$LogDirectory;
		if (mb_substr($logDirConfiguredPath, 0, 1) === '~') {
			$app = static::$app ?: (static::$app = & \MvcCore\Application::GetInstance());
			$logDirAbsPath = $app->GetRequest()->GetAppRoot() . '/' . ltrim(mb_substr($logDirConfiguredPath, 1), '/');
		} else {
			$logDirAbsPath = $logDirConfiguredPath;
		}
		static::$LogDirectory = $logDirAbsPath;
		try {
			if (!is_dir($logDirAbsPath)) {
				$selfClass = version_compare(PHP_VERSION, '5.5', '>') ? self::class : __CLASS__;
				if (!mkdir($logDirAbsPath, 0777, TRUE))
					throw new \RuntimeException(
						'['.$selfClass."] It was not possible to create log directory: `".$logDirAbsPath."`."
					);
				if (!is_writable($logDirAbsPath))
					if (!chmod($logDirAbsPath, 0777))
						throw new \RuntimeException(
							'['.$selfClass."] It was not possible to setup privileges to log directory: `".$logDirAbsPath."` to writeable mode 0777."
						);
			}
		} catch (\Exception $e) {
			$selfClass = version_compare(PHP_VERSION, '5.5', '>') ? self::class : __CLASS__;
			die('['.$selfClass.'] ' . $e->getMessage());
		}
		static::$logDirectoryInitialized = TRUE;
		return $logDirAbsPath;
	}
40549
static function write( $message, $logName = 'common.log', $dir = 'var/log' )
    {
        $fileName = $dir . '/' . $logName;
        $oldumask = @umask( 0 );

        $fileExisted = file_exists( $fileName );
        if ( $fileExisted and
             filesize( $fileName ) > eZLog::maxLogSize() )
        {
            if ( eZLog::rotateLog( $fileName ) )
                $fileExisted = false;
        }
        else if ( !$fileExisted and !file_exists( $dir ) )
        {
            eZDir::mkdir( $dir, false, true );
        }

        $logFile = @fopen( $fileName, "a" );
        if ( $logFile )
        {
            $time = strftime( "%b %d %Y %H:%M:%S", strtotime( "now" ) );
            $logMessage = "[ " . $time . " ] $message\n";
            @fwrite( $logFile, $logMessage );
            @fclose( $logFile );
            if ( !$fileExisted )
            {
                $ini = eZINI::instance();
                $permissions = octdec( $ini->variable( 'FileSettings', 'LogFilePermissions' ) );
                @chmod( $fileName, $permissions );
            }
            @umask( $oldumask );
        }
        else
        {
            eZDebug::writeError( 'Couldn\'t create the log file "' . $fileName . '"', __METHOD__ );
        }
    }