private static function init() {
        static $initialized = false;
        if ($initialized) return;

        /** @var ConfigInterface $config */
        $config = self::di('config');

        // (1) Get the application's default loglevel configuration (fall back to the built-in default).
        $logLevel = $config->get('log.level', '');
        if (is_array($logLevel))
            $logLevel = isset($logLevel['']) ? $logLevel[''] : '';
        $logLevel = self::logLevelToId($logLevel) ?: self::DEFAULT_LOGLEVEL;
        self::$appLogLevel = $logLevel;


        // (2) mail handler: enabled if mail receivers are configured
        $receivers = [];
        foreach (explode(',', $config->get('log.mail.receiver', '')) as $receiver) {
            if ($receiver = trim($receiver)) {
                if (filter_var($receiver, FILTER_VALIDATE_EMAIL)) {         // silently skip invalid addresses
                    $receivers[] = $receiver;
                }
            }
        }
        self::$mailHandler   = (bool) $receivers;
        self::$mailReceivers =        $receivers;


        // (3) L_FATAL print handler: enabled on local/white-listed access or if explicitely enabled
        self::$printFatalHandler = CLI || Application::isAdminIP() || ini_get_bool('display_errors');


        // (4) non L_FATAL print handler: enabled on local access, if explicitely enabled or if the mail handler is disabled
        self::$printNonfatalHandler = CLI || in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', $_SERVER['SERVER_ADDR']])
                                          || ini_get_bool('display_errors')
                                          || (self::$printFatalHandler && !self::$mailHandler);

        // (5) SMS handler: enabled if SMS receivers are configured (operator settings are checked at log time)
        self::$smsReceivers = [];
        foreach (explode(',', $config->get('log.sms.receiver', '')) as $receiver) {
            if ($receiver=trim($receiver)) {
                if (strStartsWith($receiver, '+' )) $receiver = substr($receiver, 1);
                if (strStartsWith($receiver, '00')) $receiver = substr($receiver, 2);
                if (!ctype_digit($receiver)) {
                    self::log('Invalid SMS receiver configuration: "'.$receiver.'"', L_WARN, ['class'=>__CLASS__, 'file'=>__FILE__, 'line'=>__LINE__]);
                    continue;
                }
                self::$smsReceivers[] = $receiver;
            }
        }
        $logLevel = $config->get('log.sms.level', self::$appLogLevel);
        if (is_string($logLevel))                                   // a string if configured
            $logLevel = self::logLevelToId($logLevel) ?: self::$appLogLevel;
        self::$smsLogLevel = $logLevel;

        $options = $config->get('sms', []);
        if (!is_array($options)) throw new IllegalTypeException('Invalid type of config value "sms": '.gettype($options).' (not array)');
        self::$smsOptions = $options;

        self::$smsHandler = self::$smsReceivers && self::$smsOptions;


        // (6) PHP error_log handler: enabled if the mail handler is disabled
        self::$errorLogHandler = !self::$mailHandler;

        $initialized = true;
    }