/** * Initializes the default logger configuration. * * @return void */ protected function initDefaultLoggers() { // we dont need any processors $processors = array(); // initialize the params for the system logger handler $handlerParams = array(); $logLevelParam = new ParamNode('logLevel', 'string', new NodeValue(LogLevel::INFO)); $logFileParam = new ParamNode('logFile', 'string', new NodeValue('var/log/appserver-errors.log')); $handlerParams[$logFileParam->getPrimaryKey()] = $logFileParam; $handlerParams[$logLevelParam->getPrimaryKey()] = $logLevelParam; // initialize the handler $handlers = array(); $handler = new HandlerNode('\\AppserverIo\\Logger\\Handlers\\CustomFileHandler', null, $handlerParams); $handlers[$handler->getPrimaryKey()] = $handler; // initialize the system logger with the processor and the handlers $systemLogger = new LoggerNode(LoggerUtils::SYSTEM, '\\AppserverIo\\Logger\\Logger', 'system', $processors, $handlers); // we dont need any processors $processors = array(); // initialize the params for the access logger formatter $formatterParams = array(); $messageFormatParam = new ParamNode('format', 'string', new NodeValue('%4$s')); $formatterParams[$messageFormatParam->getPrimaryKey()] = $messageFormatParam; // initialize the formatter for the access logger $formatter = new FormatterNode('\\AppserverIo\\Logger\\Formatters\\StandardFormatter', $formatterParams); // initialize the params for the system logger handler $handlerParams = array(); $logLevelParam = new ParamNode('logLevel', 'string', new NodeValue(LogLevel::DEBUG)); $logFileParam = new ParamNode('logFile', 'string', new NodeValue('var/log/appserver-access.log')); $handlerParams[$logFileParam->getPrimaryKey()] = $logFileParam; $handlerParams[$logLevelParam->getPrimaryKey()] = $logLevelParam; // initialize the handler $handlers = array(); $handler = new HandlerNode('\\AppserverIo\\Logger\\Handlers\\CustomFileHandler', $formatter, $handlerParams); $handlers[$handler->getPrimaryKey()] = $handler; // initialize the system logger with the processor and the handlers $accessLogger = new LoggerNode(LoggerUtils::ACCESS, '\\AppserverIo\\Logger\\Logger', 'access', $processors, $handlers); // add the loggers to the default logger configuration $this->loggers[$systemLogger->getPrimaryKey()] = $systemLogger; $this->loggers[$accessLogger->getPrimaryKey()] = $accessLogger; }