// Build the log file header.
$head = $this->generateFileHeader();
if (!File::write($this->path, $head)) {
throw new \RuntimeException('Cannot write to log file.');
}
}
/**
* Method to parse the format string into an array of fields.
if ($this->defer) {
$this->deferredEntries[] = $entry;
} else {
// Write it immediately.
// Initialise the file if not already done.
$this->initFile();
// Write the new entry to the file.
$line = $this->formatLine($entry);
$line .= "\n";
$this->loggers[$signature] = new $class($this->configurations[$signature]);
}
// Add the entry to the logger.
$this->loggers[$signature]->addEntry(clone $entry);
}
}
/**
* Method to find the loggers to use based on priority and category values.
// If the entry object isn't a LogEntry object let's make one.
if (!($entry instanceof LogEntry)) {
$entry = new LogEntry((string) $entry, $priority, $category, $date, $context);
}
static::$instance->addLogEntry($entry);
}
/**
* Add a logger to the Log instance. Loggers route log entries to the correct files/systems to be logged.
*
}
$priority = $this->psrToJoomlaPriorityMap[$level];
$date = @$context['date'] ?? null;
Log::add((string) $message, $priority, $this->category, $date, $context);
}
}
*
* @return void
*/
public function error($message, array $context = array())
{
$this->log(LogLevel::ERROR, $message, $context);
}
/**
* Exceptional occurrences that are not errors.
*
* Example: Use of deprecated APIs, poor use of an API, undesirable things
public static function logException(Exception $e): void
{
$container = ContainerFactory::getContainer();
/** @var LoggerInterface $logger */
$logger = $container->get(LoggerInterface::class);
$logger->error((string)$e);
}
}
public function onException(ExceptionEvent $event)
{
$options = $this->getOptions();
$callback = $options->getExceptionCallback();
if ($callback) {
call_user_func($callback, $event->getException());
}
$event->setThrowException($options->getThrowExceptions());
}
}
// Execute listeners
$responses = new ResponseCollection();
foreach ($listOfListenersByPriority as $listOfListeners) {
foreach ($listOfListeners as $listeners) {
foreach ($listeners as $listener) {
$response = $listener($event);
$responses->push($response);
// If the event was asked to stop propagating, do so
if ($event->propagationIsStopped()) {
$responses->setStopped(\true);
return $responses;
/**
* @inheritDoc
*/
public function triggerEvent(EventInterface $event)
{
return $this->triggerListeners($event);
}
/**
* @inheritDoc
*/
public function triggerEventUntil(callable $callback, EventInterface $event)
* @return mixed
*/
protected function triggerException($eventName, ArrayObject $args, &$result, \Exception $exception)
{
$exceptionEvent = new ExceptionEvent($eventName . '.exception', $this, $args, $result, $exception);
$eventRs = $this->getEventManager()->triggerEvent($exceptionEvent);
if ($exceptionEvent->getThrowException()) {
throw $exceptionEvent->getException();
}
return $eventRs->stopped() ? $eventRs->last() : $exceptionEvent->getResult();
}
$eventRs = $this->triggerPre(__FUNCTION__, $args);
$result = $eventRs->stopped() ? $eventRs->last() : $this->internalSetItem($args['key'], $args['value']);
return $this->triggerPost(__FUNCTION__, $args, $result);
} catch (\Exception $e) {
$result = \false;
return $this->triggerException(__FUNCTION__, $args, $result, $e);
}
}
/**
* Internal method to store an item.
*
{
$options = $this->getOptions();
if ($options->getWritable() && $options->getClearStatCache()) {
$this->filesystem->clearStatCache();
}
return parent::setItem($key, $value);
}
/**
* Store multiple items.
*
* @param array $keyValuePairs
'headers' => $this->utility->getHeaders()
];
try {
//Save an empty page using the same id then tag it
$this->taggableCache->setItem(
$this->cacheId,
'<html lang><head><title></title></head><body></body></html>'
);
$this->taggableCache->setTags(
$this->cacheId,
//Page cache could be disabled at runtime so check again here
if ($this->enabled && $this->app instanceof CMSApplication && $this->pageCache->getCachingEnabled()) {
$body = $this->app->getBody();
//Still need to validate the HTMl here. We may be on a redirect.
if (Helper::validateHtml($body)) {
$this->pageCache->store($this->addUpdateHitScript($this->addUpdateFormTokenAjax($body)));
}
}
}
/**
foreach ($this->listeners[$event->getName()] as $listener) {
if ($event->isStopped()) {
return $event;
}
$listener($event);
}
}
return $event;
}
$dispatcher = $this->getDispatcher();
} catch (\UnexpectedValueException $exception) {
return null;
}
return $dispatcher->dispatch($eventName, $event ?: new ApplicationEvent($eventName, $this));
}
/**
* Method to run the application routines.
*
// Send the application response.
$this->respond();
// Trigger the onAfterRespond event.
$this->dispatchEvent(
'onAfterRespond',
new AfterRespondEvent('onAfterRespond', ['subject' => $this])
);
}
// Set the application as global app
\Joomla\CMS\Factory::$application = $app;
// Execute the application.
$app->execute();
* define() is used rather than "const" to not error for PHP 5.2 and lower
*/
define('_JEXEC', 1);
// Run the application - All executable code should be triggered through this file
require_once dirname(__FILE__) . '/includes/app.php';
RuntimeException
|
---|
RuntimeException: Cannot write to log file. at /mnt/web614/b0/69/511984669/htdocs/joomla/libraries/src/Log/Logger/FormattedtextLogger.php:273 at Joomla\CMS\Log\Logger\FormattedtextLogger->initFile() (/mnt/web614/b0/69/511984669/htdocs/joomla/libraries/src/Log/Logger/FormattedtextLogger.php:162) at Joomla\CMS\Log\Logger\FormattedtextLogger->addEntry() (/mnt/web614/b0/69/511984669/htdocs/joomla/libraries/src/Log/Log.php:351) at Joomla\CMS\Log\Log->addLogEntry() (/mnt/web614/b0/69/511984669/htdocs/joomla/libraries/src/Log/Log.php:176) at Joomla\CMS\Log\Log::add() (/mnt/web614/b0/69/511984669/htdocs/joomla/administrator/components/com_jchoptimize/src/Joomla/Log/JoomlaLogger.php:63) at CodeAlfa\Component\JchOptimize\Administrator\Joomla\Log\JoomlaLogger->log() (/mnt/web614/b0/69/511984669/htdocs/joomla/administrator/components/com_jchoptimize/lib/vendor/psr/log/Psr/Log/AbstractLogger.php:66) at _JchOptimizeVendor\Psr\Log\AbstractLogger->error() (/mnt/web614/b0/69/511984669/htdocs/joomla/administrator/components/com_jchoptimize/lib/src/Laminas/Plugins/ExceptionHandler.php:27) at JchOptimize\Core\Laminas\Plugins\ExceptionHandler::logException() (/mnt/web614/b0/69/511984669/htdocs/joomla/administrator/components/com_jchoptimize/lib/vendor/laminas/laminas-cache/src/Storage/Plugin/ExceptionHandler.php:55) at _JchOptimizeVendor\Laminas\Cache\Storage\Plugin\ExceptionHandler->onException() (/mnt/web614/b0/69/511984669/htdocs/joomla/administrator/components/com_jchoptimize/lib/vendor/laminas/laminas-eventmanager/src/EventManager.php:270) at _JchOptimizeVendor\Laminas\EventManager\EventManager->triggerListeners() (/mnt/web614/b0/69/511984669/htdocs/joomla/administrator/components/com_jchoptimize/lib/vendor/laminas/laminas-eventmanager/src/EventManager.php:148) at _JchOptimizeVendor\Laminas\EventManager\EventManager->triggerEvent() (/mnt/web614/b0/69/511984669/htdocs/joomla/administrator/components/com_jchoptimize/lib/vendor/laminas/laminas-cache/src/Storage/Adapter/AbstractAdapter.php:224) at _JchOptimizeVendor\Laminas\Cache\Storage\Adapter\AbstractAdapter->triggerException() (/mnt/web614/b0/69/511984669/htdocs/joomla/administrator/components/com_jchoptimize/lib/vendor/laminas/laminas-cache/src/Storage/Adapter/AbstractAdapter.php:566) at _JchOptimizeVendor\Laminas\Cache\Storage\Adapter\AbstractAdapter->setItem() (/mnt/web614/b0/69/511984669/htdocs/joomla/administrator/components/com_jchoptimize/lib/vendor/laminas/laminas-cache-storage-adapter-filesystem/src/Filesystem.php:716) at _JchOptimizeVendor\Laminas\Cache\Storage\Adapter\Filesystem->setItem() (/mnt/web614/b0/69/511984669/htdocs/joomla/administrator/components/com_jchoptimize/lib/src/PageCache/PageCache.php:222) at JchOptimize\Core\PageCache\PageCache->store() (/mnt/web614/b0/69/511984669/htdocs/joomla/plugins/system/jchpagecache/src/Extension/JchPageCache.php:178) at CodeAlfa\Plugin\System\JchPageCache\Extension\JchPageCache->onAfterRespond() (/mnt/web614/b0/69/511984669/htdocs/joomla/libraries/vendor/joomla/event/src/Dispatcher.php:454) at Joomla\Event\Dispatcher->dispatch() (/mnt/web614/b0/69/511984669/htdocs/joomla/libraries/vendor/joomla/application/src/AbstractApplication.php:99) at Joomla\Application\AbstractApplication->dispatchEvent() (/mnt/web614/b0/69/511984669/htdocs/joomla/libraries/src/Application/CMSApplication.php:349) at Joomla\CMS\Application\CMSApplication->execute() (/mnt/web614/b0/69/511984669/htdocs/joomla/includes/app.php:58) at require_once('/mnt/web614/b0/69/511984669/htdocs/joomla/includes/app.php') (/mnt/web614/b0/69/511984669/htdocs/joomla/index.php:32) |