mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 08:14:03 +02:00
Application log: don't use Icinga\Application\Config to get the log file name
refs #7060
This commit is contained in:
parent
3b8fcb80a8
commit
f4b820aa57
@ -4,9 +4,11 @@
|
|||||||
|
|
||||||
use Icinga\Module\Monitoring\Controller;
|
use Icinga\Module\Monitoring\Controller;
|
||||||
use Icinga\Web\Hook;
|
use Icinga\Web\Hook;
|
||||||
use Icinga\Application\Config as IcingaConfig;
|
|
||||||
use Icinga\Web\Url;
|
use Icinga\Web\Url;
|
||||||
use Icinga\Data\ResourceFactory;
|
use Icinga\Data\ResourceFactory;
|
||||||
|
use Icinga\Logger\Logger;
|
||||||
|
use Icinga\Logger\Writer\FileWriter;
|
||||||
|
use Icinga\Protocol\File\Reader as FileReader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ListController
|
* Class ListController
|
||||||
@ -37,15 +39,16 @@ class ListController extends Controller
|
|||||||
public function applicationlogAction()
|
public function applicationlogAction()
|
||||||
{
|
{
|
||||||
$this->addTitleTab('application log');
|
$this->addTitleTab('application log');
|
||||||
$config_ini = IcingaConfig::app()->toArray();
|
|
||||||
if (!in_array('logging', $config_ini) || (
|
$loggerWriter = Logger::getInstance()->getWriter();
|
||||||
in_array('type', $config_ini['logging']) &&
|
if ($loggerWriter instanceof FileWriter) {
|
||||||
$config_ini['logging']['type'] === 'file' &&
|
$resource = new FileReader(new Zend_Config(array(
|
||||||
in_array('target', $config_ini['logging']) &&
|
'filename' => $loggerWriter->getPath(),
|
||||||
file_exists($config_ini['logging']['target'])
|
'fields' => '/^(?<datetime>[0-9]{4}(-[0-9]{2}){2}' // date
|
||||||
)
|
. 'T[0-9]{2}(:[0-9]{2}){2}([\\+\\-][0-9]{2}:[0-9]{2})?)' // time
|
||||||
) {
|
. ' - (?<loglevel>[A-Za-z]+)' // loglevel
|
||||||
$resource = ResourceFactory::create('logfile');
|
. ' - (?<message>.*)$/' // message
|
||||||
|
)));
|
||||||
$this->view->logData = $resource->select()->order('DESC')->paginate();
|
$this->view->logData = $resource->select()->order('DESC')->paginate();
|
||||||
} else {
|
} else {
|
||||||
$this->view->logData = null;
|
$this->view->logData = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user