本文整理汇总了PHP中Logger::emergency方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::emergency方法的具体用法?PHP Logger::emergency怎么用?PHP Logger::emergency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logger
的用法示例。
在下文中一共展示了Logger::emergency方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* @static
* @return mixed|\Zend_Db_Adapter_Abstract
*/
public static function get()
{
try {
if (\Zend_Registry::isRegistered("Pimcore_Resource_Mysql")) {
$connection = \Zend_Registry::get("Pimcore_Resource_Mysql");
if ($connection instanceof Wrapper) {
return $connection;
}
}
} catch (\Exception $e) {
\Logger::error($e);
}
// get new connection
try {
$db = self::getConnection();
self::set($db);
return $db;
} catch (\Exception $e) {
$errorMessage = "Unable to establish the database connection with the given configuration in /website/var/config/system.xml, for details see the debug.log. \nReason: " . $e->getMessage();
\Logger::emergency($errorMessage);
\Logger::emergency($e);
\Pimcore\Tool::exitWithError($errorMessage);
}
}
示例2: testEmergancyLevel
public function testEmergancyLevel()
{
$this->expectOutputString('emergency: Message contents');
$echo = new Adaptors\EchoAdaptor('debug', '{level}: {message}');
$logger = new Logger($echo);
$logger->emergency('Message contents');
}
示例3: _handleError
/**
* @param \Zend_Controller_Request_Abstract $request
* @throws mixed
*/
protected function _handleError(\Zend_Controller_Request_Abstract $request)
{
// remove zend error handler
$front = \Zend_Controller_Front::getInstance();
$front->unregisterPlugin("Zend_Controller_Plugin_ErrorHandler");
$response = $this->getResponse();
if ($response->isException() && !$this->_isInsideErrorHandlerLoop) {
// get errorpage
try {
// enable error handler
$front->setParam('noErrorHandler', false);
$errorPath = Config::getSystemConfig()->documents->error_pages->default;
if (Site::isSiteRequest()) {
$site = Site::getCurrentSite();
$errorPath = $site->getErrorDocument();
}
if (empty($errorPath)) {
$errorPath = "/";
}
$document = Document::getByPath($errorPath);
if (!$document instanceof Document\Page) {
// default is home
$document = Document::getById(1);
}
if ($document instanceof Document\Page) {
$params = Tool::getRoutingDefaults();
if ($module = $document->getModule()) {
$params["module"] = $module;
}
if ($controller = $document->getController()) {
$params["controller"] = $controller;
$params["action"] = "index";
}
if ($action = $document->getAction()) {
$params["action"] = $action;
}
$this->setErrorHandler($params);
$request->setParam("document", $document);
\Zend_Registry::set("pimcore_error_document", $document);
// ensure that a viewRenderer exists, and is enabled
if (!\Zend_Controller_Action_HelperBroker::hasHelper("viewRenderer")) {
$viewRenderer = new \Pimcore\Controller\Action\Helper\ViewRenderer();
\Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
}
$viewRenderer = \Zend_Controller_Action_HelperBroker::getExistingHelper("viewRenderer");
$viewRenderer->setNoRender(false);
if ($viewRenderer->view === null) {
$viewRenderer->initView(PIMCORE_WEBSITE_PATH . "/views");
}
}
} catch (\Exception $e) {
\Logger::emergency("error page not found");
}
}
// call default ZF error handler
parent::_handleError($request);
}
示例4: getSystemConfig
/**
* @static
* @return Zend_Config
*/
public static function getSystemConfig()
{
$config = null;
try {
$config = Zend_Registry::get("pimcore_config_system");
} catch (Exception $e) {
try {
$config = new Zend_Config_Xml(PIMCORE_CONFIGURATION_SYSTEM);
self::setSystemConfig($config);
} catch (Exception $e) {
Logger::emergency("Cannot find system configuration, should be located at: " . PIMCORE_CONFIGURATION_SYSTEM);
}
}
return $config;
}
示例5: reset
/**
* @static
* @return Zend_Db_Adapter_Abstract
*/
public static function reset()
{
// close old connections
self::close();
// get new connection
try {
$db = self::getConnection();
self::set($db);
return $db;
} catch (Exception $e) {
$errorMessage = "Unable to establish the database connection with the given configuration in /website/var/config/system.xml, for details see the debug.log. \nReason: " . $e->getMessage();
Logger::emergency($errorMessage);
Logger::emergency($e);
die($errorMessage);
}
}
示例6: test_methods_Magento
public function test_methods_Magento()
{
$CONFIG_FILE_NAME = __DIR__ . '/logging_exception.yaml';
$LOGGER_NAME = 'defaultLoggerName';
/**
* Perform testing.
*/
$log = new Logger($CONFIG_FILE_NAME, $LOGGER_NAME);
$context = ['test' => true, 'env' => ['param1' => 'value1']];
$log->debug('debug', $context);
$log->info('info', $context);
$log->notice('notice', $context);
$log->warning('warning', $context);
$log->error('error', $context);
$log->alert('alert', $context);
$log->critical('critical', $context);
$log->emergency('emergency', $context);
}
示例7: getSystemConfig
/**
* @static
* @return Zend_Config
*/
public static function getSystemConfig()
{
$config = null;
if (Zend_Registry::isRegistered("pimcore_config_system")) {
$config = Zend_Registry::get("pimcore_config_system");
} else {
try {
$config = new Zend_Config_Xml(PIMCORE_CONFIGURATION_SYSTEM);
self::setSystemConfig($config);
} catch (Exception $e) {
Logger::emergency("Cannot find system configuration, should be located at: " . PIMCORE_CONFIGURATION_SYSTEM);
if (is_file(PIMCORE_CONFIGURATION_SYSTEM)) {
die("Your system.xml located at " . PIMCORE_CONFIGURATION_SYSTEM . " is invalid, please check and correct it manually!");
}
}
}
return $config;
}
示例8: _handleError
protected function _handleError(Zend_Controller_Request_Abstract $request)
{
// remove zend error handler
$front = Zend_Controller_Front::getInstance();
$front->unregisterPlugin("Zend_Controller_Plugin_ErrorHandler");
$response = $this->getResponse();
if ($response->isException() && !$this->_isInsideErrorHandlerLoop) {
// get errorpage
try {
// enable error handler
$front->setParam('noErrorHandler', false);
$siteKey = Pimcore_Tool_Frontend::getSiteKey();
$errorPath = Pimcore_Config::getSystemConfig()->documents->error_pages->{$siteKey};
if (empty($errorPath)) {
$errorPath = "/";
}
$document = Document::getByPath($errorPath);
if (!$document instanceof Document_Page) {
// default is home
$document = Document::getById(1);
}
if ($document instanceof Document_Page) {
$params = Pimcore_Tool::getRoutingDefaults();
if ($module = $document->getModule()) {
$params["module"] = $module;
}
if ($controller = $document->getController()) {
$params["controller"] = $controller;
$params["action"] = "index";
}
if ($action = $document->getAction()) {
$params["action"] = $action;
}
$this->setErrorHandler($params);
$request->setParam("document", $document);
Zend_Registry::set("pimcore_error_document", $document);
}
} catch (Exception $e) {
Logger::emergency("error page not found");
}
}
// call default ZF error handler
parent::_handleError($request);
}
示例9: getConfig
/**
* @static
* @return \Zend_Config
*/
public static function getConfig()
{
$config = NULL;
if (\Zend_Registry::isRegistered('toolbox_config')) {
$config = \Zend_Registry::get('toolbox_config');
} else {
$configFile = TOOLBOX_CONFIGURATION_FILE;
try {
$config = new \Zend_Config(include $configFile);
self::setConfig($config, 'toolbox_config');
} catch (\Exception $e) {
\Logger::emergency("Cannot find system configuration, should be located at: " . $configFile);
if (is_file($configFile)) {
Tool::exitWithError("Your toolbox_configuration.php located at " . $configFile . " is invalid, please check and correct it manually!");
}
}
}
return $config;
}
示例10: getConfig
/**
* @static
* @return \Zend_Config
*/
public static function getConfig()
{
$config = null;
if (\Zend_Registry::isRegistered("coreshop_config")) {
$config = \Zend_Registry::get("coreshop_config");
} else {
try {
$config = new \Zend_Config_Xml(CORESHOP_CONFIGURATION);
self::setConfig($config);
} catch (\Exception $e) {
\Logger::emergency("Cannot find system configuration, should be located at: " . PIMCORE_CONFIGURATION_SYSTEM);
if (is_file(CORESHOP_CONFIGURATION)) {
$m = "Your coreshop-config.xml located at " . CORESHOP_CONFIGURATION . " is invalid, please check and correct it manually!";
\Pimcore\Tool::exitWithError($m);
}
}
}
return $config;
}
示例11: getWorkflowManagementConfig
/**
* @param bool $forceReload
* @return array|null
*/
public static function getWorkflowManagementConfig($forceReload = false)
{
$config = null;
if (\Zend_Registry::isRegistered("pimcore_config_workflowmanagement") && !$forceReload) {
$config = \Zend_Registry::get("pimcore_config_workflowmanagement");
} else {
try {
$file = \Pimcore\Config::locateConfigFile("workflowmanagement.php");
if (is_file($file)) {
$config = (include $file);
if (is_array($config)) {
self::setWorkflowManagementConfig($config);
} else {
\Logger::error("{$file} exists but it is not a valid PHP array configuration.");
}
}
} catch (\Exception $e) {
$file = \Pimcore\Config::locateConfigFile("workflowmanagement.php");
\Logger::emergency("Cannot find workflow configuration, should be located at: " . $file);
}
}
return $config;
}
示例12: initSession
/**
* @static
* @return void
*/
public static function initSession()
{
if (!\Zend_Session::isStarted()) {
\Zend_Session::setOptions(self::$options);
}
try {
try {
if (!\Zend_Session::isStarted()) {
$sName = self::getOption("name");
// only set the session id if the cookie isn't present, otherwise Set-Cookie is always in the headers
if (array_key_exists($sName, $_REQUEST) && !empty($_REQUEST[$sName]) && (!array_key_exists($sName, $_COOKIE) || empty($_COOKIE[$sName]))) {
// get zend_session work with session-id via get (since SwfUpload doesn't support cookies)
\Zend_Session::setId($_REQUEST[$sName]);
}
}
} catch (\Exception $e) {
\Logger::error("Problem while starting session");
\Logger::error($e);
}
} catch (\Exception $e) {
\Logger::emergency("there is a problem with admin session");
die;
}
}
示例13: initSession
/**
* @static
* @return void
*/
public static function initSession()
{
Zend_Session::setOptions(array("throw_startup_exceptions" => false, "gc_maxlifetime" => 7200, "name" => "pimcore_admin_sid", "strict" => false, "use_only_cookies" => false));
try {
try {
if (!Zend_Session::isStarted()) {
$sName = Zend_Session::getOptions("name");
// only set the session id if the cookie isn't present, otherwise Set-Cookie is always in the headers
if (array_key_exists($sName, $_REQUEST) && !empty($_REQUEST[$sName]) && (!array_key_exists($sName, $_COOKIE) || empty($_COOKIE[$sName]))) {
// get zend_session work with session-id via get (since SwfUpload doesn't support cookies)
Zend_Session::setId($_REQUEST[$sName]);
}
// register session
Zend_Session::start();
}
} catch (Exception $e) {
Logger::error("Problem while starting session");
Logger::error($e);
}
} catch (Exception $e) {
Logger::emergency("there is a problem with admin session");
die;
}
}
示例14: checkForErrors
public function checkForErrors()
{
if ($error = $this->_getParam('error_handler')) {
if ($error->exception) {
if ($error->exception instanceof Zend_Controller_Router_Exception || $error->exception instanceof Zend_Controller_Action_Exception) {
header('HTTP/1.1 404 Not Found');
//$this->getResponse()->setRawHeader('HTTP/1.1 404 Not Found');
$this->getResponse()->setHttpResponseCode(404);
} else {
header('HTTP/1.1 503 Service Temporarily Unavailable');
//$this->getResponse()->setRawHeader('HTTP/1.1 503 Service Temporarily Unavailable');
$this->getResponse()->setHttpResponseCode(503);
}
Logger::emergency("Unable to load URL: " . $_SERVER["REQUEST_URI"]);
Logger::emergency($error->exception);
try {
$document = Zend_Registry::get("pimcore_error_document");
$this->setDocument($document);
$this->_setParam("document", $document);
$this->disableLayout();
} catch (Exception $e) {
die("Unable to load error document");
}
}
}
}
示例15: get
/**
* @param string $namespace
* @param bool $readOnly
* @return \Zend_Session_Namespace
* @throws \Zend_Session_Exception
*/
public static function get($namespace = "pimcore_admin", $readOnly = false)
{
$initSession = !\Zend_Session::isStarted();
$forceStart = !$readOnly;
// we don't force the session to start in read-only mode (default behavior)
$sName = self::getOption("name");
if (self::backupForeignSession()) {
$initSession = true;
$forceStart = true;
}
if ($initSession) {
\Zend_Session::setOptions(self::$options);
}
try {
try {
if ($initSession) {
// only set the session id if the cookie isn't present, otherwise Set-Cookie is always in the headers
if (array_key_exists($sName, $_REQUEST) && !empty($_REQUEST[$sName]) && (!array_key_exists($sName, $_COOKIE) || empty($_COOKIE[$sName]))) {
// get zend_session work with session-id via get (since SwfUpload doesn't support cookies)
\Zend_Session::setId($_REQUEST[$sName]);
}
}
} catch (\Exception $e) {
\Logger::error("Problem while starting session");
\Logger::error($e);
}
} catch (\Exception $e) {
\Logger::emergency("there is a problem with admin session");
die;
}
if ($initSession) {
\Zend_Session::start();
}
if ($forceStart) {
@session_start();
self::$sessionCookieCleanupNeeded = true;
}
if (!array_key_exists($namespace, self::$sessions) || !self::$sessions[$namespace] instanceof \Zend_Session_Namespace) {
try {
self::$sessions[$namespace] = new Session\Container($namespace);
} catch (\Exception $e) {
// invalid session, regenerate the session, and return a dummy object
\Zend_Session::regenerateId();
return new \stdClass();
}
}
self::$openedSessions++;
self::$sessions[$namespace]->unlock();
return self::$sessions[$namespace];
}