Initialize the logger

@return \Gems_Log
766920
protected function _initLogger()
    {
        $this->bootstrap('project');    // Make sure the project object is available
        $logger = \Gems_Log::getLogger();

        $logPath = GEMS_ROOT_DIR . '/var/logs';

        try {
            $writer = new \Zend_Log_Writer_Stream($logPath . '/errors.log');
        } catch (Exception $exc) {
            try {
                // Try to solve the problem, otherwise fail heroically
                \MUtil_File::ensureDir($logPath);
                $writer = new \Zend_Log_Writer_Stream($logPath . '/errors.log');
            } catch (Exception $exc) {
                $this->bootstrap(array('locale', 'translate'));
                die(str_replace(GEMS_ROOT_DIR . '/', '', sprintf(
                        $this->translateAdapter->_('Path %s not writable') . "\n%s\n",
                        $logPath,
                        $exc->getMessage()
                        )));
            }
        }

        $filter = new \Zend_Log_Filter_Priority($this->project->getLogLevel());
        $writer->addFilter($filter);
        $logger->addWriter($writer);

        // OPTIONAL STARTY OF FIREBUG LOGGING.
        if ($this->_startFirebird) {
            $logger->addWriter(new \Zend_Log_Writer_Firebug());
            //We do not add the logLevel here, as the firebug window is intended for use by
            //developers only and it is only written to the active users' own screen.
        }

        \Zend_Registry::set('logger', $logger);

        return $logger;
    }
102391
protected function registerLogger()
    {
        $this->app->singleton('bugsnag.logger', function ($app) {
            return new Logger($app['bugsnag']);
        });

        $this->app->alias('bugsnag.logger', Logger::class);
    }
1325600
public function logger()
	{
		if(!isset($this->_logger))
		{
			$this->_logger = new Logging\LoggerMultiplexer();
		}

		return $this->_logger;
	}
70982
public function getLogBuilder()
    {
        if (!is_object($this->_logBuilder)) {
            $this->_logBuilder = Yii::createObject($this->_logBuilder);
        }
        return $this->_logBuilder;
    }
243986
def rails_logger
      if instance_variable_defined?(k = :@rails_logger)
        instance_variable_get(k)
      else
        instance_variable_set(k, conf.rails && conf.rails.logger)
      end
    end
770379
public static function initialize()
    {
        $manager = self::$manager = new self();
        $manager->seedHandlerStack();

        session_set_save_handler($manager);

        return $manager;
    }
466327
private function loadLoggerDefinition()
    {
        $logger_class = $this->container->getParameter('bbapp.logger.class');
        if (true === $this->container->getParameter('debug')) {
            $logger_class = $this->container->getParameter('bbapp.logger_debug.class');
        }

        $this->container->setDefinition('logging', new Definition($logger_class, array(new Reference('bbapp'))));
    }
389505
public function getLogger(): LoggerInterface
    {
        if ($this->logger === null) {
            $this->setLogger(new NullLogger());
        }
        assert($this->logger instanceof LoggerInterface);
        return $this->logger;
    }
1174356
def init_logger(root_dir, name="train.log"):
    
    os.makedirs(root_dir, exist_ok=True)
    log_formatter = logging.Formatter("%(message)s")
    logger = logging.getLogger(name)
    file_handler = logging.FileHandler("{0}/{1}".format(root_dir, name), mode='w')
    file_handler.setFormatter(log_formatter)
    logger.addHandler(file_handler)
    console_handler = logging.StreamHandler()
    console_handler.setFormatter(log_formatter)
    logger.addHandler(console_handler)
    logger.setLevel(logging.INFO)
    return logger
565488
private function initLogger()
    {

        // Check logir exists
        if (!file_exists(LOGDIR)) {
            Throw new FrameworkException(sprintf('Logdir does not exist. Please create "%s" and make sure it is writable.', LOGDIR));
        }

        // Check logdir to be writable
        if (!is_writable(LOGDIR)) {
            Throw new FrameworkException(sprintf('Logdir "%s" is not writable. Please set proper accessrights', LOGDIR));
        }

        $this->di->mapFactory('core.logger', '\Core\Logger\Logger');

        /* @var $logger \Core\Logger\Logger */
        $this->logger = $this->di->get('core.logger');
        $this->logger->registerStream(new \Core\Logger\Streams\FileStream(LOGDIR . '/core.log'));

        $this->di->mapValue('core.logger.default', $this->logger);
    }
118702
public function getLogger()
    {
        if (!$this->logger) {
            if (!defined('STDERR')) {
                // See testGetLoggerRunFromStdin
                // @codeCoverageIgnoreStart
                define('STDERR', fopen('php://stderr', 'w'));
            }
            // @codeCoverageIgnoreEnd
            $handler = new StreamHandler(STDERR, Logger::DEBUG);
            $handler->setFormatter(new LineFormatter("%datetime% %level_name% %message% %context%\n"));
            $this->logger = new Logger(get_class($this));
            $this->logger->pushHandler($handler);
        }
        return $this->logger;
    }
580570
protected function init()
    {
        // WebDocBook booting
        $this->boot();

        // the logger
        $this->logger = new Logger(array(
            'directory'         => Kernel::getPath('log'),
            'logfile'           => Kernel::getConfig('app:logfile', 'history'),
            'error_logfile'     => Kernel::getConfig('app:error_logfile', 'errors'),
            'duplicate_errors'  => false,
        ));

        // user configuration
        $internal_config    = Kernel::getConfig('userconf', array());
        $user_config_file   = Kernel::getPath('user_config_filepath');
        if (true===file_exists($user_config_file)) {
            $user_config = FilesystemHelper::parseIni($user_config_file);
            if (!empty($user_config)) {
                Kernel::setConfig($user_config, 'user_config');
            } else {
                throw new Exception(
                    sprintf('Can not read you configuration file "%s"!', Kernel::getPath('user_config_filepath', true))
                );
            }
        } else {
            Kernel::setConfig($internal_config, 'user_config');
        }

        // creating the application default headers
        $charset        = Kernel::getConfig('html:charset', 'utf-8');
        $content_type   = Kernel::getConfig('html:content-type', 'text/html');
        $app_name       = Kernel::getConfig('title', null, 'manifest');
        $app_version    = Kernel::getConfig('version', null, 'manifest');
        $app_website    = Kernel::getConfig('homepage', null, 'manifest');
        $this->response->addHeader('Content-type', $content_type.'; charset: '.$charset);

        // expose app ?
        $expose_wdb = Kernel::getConfig('app:expose_webdocbook', true);
        if (true===$expose_wdb || 'true'===$expose_wdb || '1'===$expose_wdb) {
            $this->response->addHeader('Composed-by', $app_name.' '.$app_version.' ('.$app_website.')');
        }

        // the template builder
        $this->setTemplateBuilder(new TemplateBuilder);

        // some PHP configs
        @date_default_timezone_set( Kernel::getConfig('user_config:timezone', 'Europe/London') );
        
        // the internationalization
        $langs = Kernel::getConfig('languages:langs', array('en'=>'English'));
        $i18n_loader_opts = array(
            'language_directory'            => Kernel::getPath('i18n'),
            'language_strings_db_directory' => Kernel::getPath('user_config'),
            'language_strings_db_filename'  => basename(Kernel::get('app_i18n_filepath')),
            'force_rebuild'                 => true,
            'available_languages'           => array_combine(array_keys($langs), array_keys($langs)),
        );

        if (Kernel::isDevMode()) {
            $i18n_loader_opts['show_untranslated'] = true;
        }
        $translator = I18n::getInstance(new I18n_Loader($i18n_loader_opts));

        // language
        $def_ln = Kernel::getConfig('languages:default', 'auto');
        if (!empty($def_ln) && $def_ln==='auto') {
            $translator->setDefaultFromHttp();
            $def_ln = Kernel::getConfig('languages:fallback_language', 'en');
        }
        $trans_ln = $translator->getLanguage();
        if (empty($trans_ln)) {
            $translator->setLanguage($def_ln);
        }

        $this->getTemplateBuilder()
            ->getTwigEngine()
            ->addExtension(new I18n_Twig_Extension($translator));
    }
1258191
protected function getLogger()
    {
        if (!isset($this->logger)) {
            // When no logger is injected, create a new one
            // that doesn't do anything
            $this->logger = new Logger('api-client');
            $this->logger->setHandlers([
                new NullHandler(),
            ]);
        }

        return $this->logger;
    }
436828
protected function setLogger()
  {
    $stream = new RotatingFileHandler($this->logFile, $this->importance);
    $stream->setFormatter($this->formatter);
    
    $this->logger = new MonologLogger($this->name);
    $this->logger->pushHandler($stream);
  }
112697
public function getLogger()
    {
        if ($this->logger instanceof LoggerInterface) {
            return $this->logger;
        }
        if ($this instanceof ServiceLocatorAwareInterface) {
            $logger = $this->getServiceLocator()->get(LoggerService::SERVICE_ID);
        } else {
            $logger = ServiceManager::getServiceManager()->get(LoggerService::SERVICE_ID);
        }
        return ($logger instanceof LoggerInterface) ? $logger : new NullLogger();
    }
434276
public function log()
    {
        if (is_null($this->log)) {
            $this->log = app(Log::class);
        }

        return $this->log;
    }
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;
	}