當前位置: 首頁>>代碼示例>>PHP>>正文


PHP logger::emerg方法代碼示例

本文整理匯總了PHP中logger::emerg方法的典型用法代碼示例。如果您正苦於以下問題:PHP logger::emerg方法的具體用法?PHP logger::emerg怎麽用?PHP logger::emerg使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在logger的用法示例。


在下文中一共展示了logger::emerg方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: exception

 function exception(Exception $e)
 {
     logger::emerg("Unhandled exception: (%s) %s in %s:%d", get_class($e), $e->getMessage(), str_replace(BASE_PATH, '', $e->getFile()), $e->getLine());
     Console::debugEx(0, get_class($e), "Unhandled exception: (%s) %s in %s:%d", get_class($e), $e->getMessage(), str_replace(BASE_PATH, '', $e->getFile()), $e->getLine());
     $f = file($e->getFile());
     foreach ($f as $i => $line) {
         $mark = $i + 1 == $e->getLine() ? '=> ' : '   ';
         $f[$i] = sprintf('  %05d. %s', $i + 1, $mark) . $f[$i];
         $f[$i] = str_replace("\n", "", $f[$i]);
     }
     $first = $e->getLine() - 4;
     if ($first < 0) {
         $first = 0;
     }
     $last = $e->getLine() + 3;
     if ($last >= count($f)) {
         $last = count($f) - 1;
     }
     $source = join("\n", array_slice($f, $first, $last - $first));
     Console::debugEx(0, get_class($e), Console::backtrace(0, $e->getTrace(), true));
     Console::debugEx(LOG_LOG, "Exception", "Source dump of %s:\n%s", str_replace(BASE_PATH, '', $e->getFile()), $source);
     $rv = 1;
     logger::emerg("Exiting with return code %d after exception.", $rv);
     Console::debugEx(LOG_BASIC, __CLASS__, "Exiting with return code %d after exception.", $rv);
 }
開發者ID:noccy80,項目名稱:lepton-ng,代碼行數:25,代碼來源:exception.php

示例2: exec

 /**
  * 多進程執行隊列
  *
  * @param string $queue_name
  * @param int $max
  * @param string $phpExec
  */
 public function exec($queue_name, $max, $phpExec = '')
 {
     $max = $max ? $max : 1;
     $time = time();
     while (1) {
         //執行死循環
         try {
             while ($this->threadRunning < $max && !system_queue::instance()->is_end($queue_name)) {
                 $this->running[] = new system_queue_consumer_proc_thread($queue_name, $phpExec);
                 usleep(200000);
                 $this->threadRunning++;
             }
         } catch (Exception $e) {
             switch ($e->getCode()) {
                 case 30001:
                     logger::emerg(sprintf('ERROR:%d @ %s', $e->getCode(), $e->getMessage));
                     exit;
             }
         }
         //檢查是否已經結束
         if ($this->threadRunning == 0) {
             break;
         }
         //等待代碼執行完成
         usleep(50000);
         $thread_close = array();
         //記錄線程的關閉狀態
         //檢查已經完成的任務
         foreach ($this->running as $idx => $thread) {
             if (!$thread->isRunning() || $thread->isOverExecuted($max)) {
                 $thread_close[] = proc_close($thread->resource);
                 //記錄線程的關閉狀態
                 unset($this->running[$idx]);
                 $this->threadRunning--;
             }
         }
     }
 }
開發者ID:sss201413,項目名稱:ecstore,代碼行數:45,代碼來源:proc.php

示例3: main

 function main()
 {
     $tagctl = app::get('desktop')->model('tag');
     $tag_rel = app::get('desktop')->model('tag_rel');
     $tag_name = $_POST['tag']['name'];
     $tag_stat = $_POST['tag']['stat'];
     $tag_ids = $_POST['tag']['tag_id'];
     if ($_POST['filter']) {
         $obj = $this->object;
         $schema = $obj->get_schema();
         $idColumn = $schema['idColumn'];
         $filter = unserialize($_POST['filter']);
         logger::emerg('---zz' . var_export($filter, true));
         $rows = $obj->getList($idColumn, $filter, 0, -1);
         foreach ($rows as $value) {
             $pkey[] = $value[$idColumn];
         }
     }
     $pkey = (array) $pkey;
     //沒有選擇任何標簽情況 time:2010-11-24
     if (!$tag_stat || !is_array($tag_stat)) {
         header('Content-Type:application/json; charset=utf-8');
         echo '{error:"' . app::get('desktop')->_('標簽設置失敗!') . '"}';
         exit;
     }
     foreach ($tag_stat as $key => $value) {
         if ($value == 2) {
             continue;
         }
         if ($value == 1) {
             //取消標簽
             $tag_item = $tagctl->getList('tag_id', array('tag_name' => $tag_name[$key], 'tag_type' => $this->object->table_name()));
             foreach ($pkey as $id) {
                 if (!intval($id) && !intval($tag_item[0]['tag_id'])) {
                     continue;
                 }
                 $tag_rel->delete(array('tag_id' => $tag_item[0]['tag_id'], 'rel_id' => $id));
             }
         } else {
             //設置標簽
             $tag_item = $tagctl->getList('tag_id', array('tag_name' => $tag_name[$key], 'tag_type' => $this->object->table_name()));
             if ($tag_item && !$tag_ids[$key]) {
                 header('Content-Type:application/json; charset=utf-8');
                 echo '{error:"' . app::get('desktop')->_('標簽重複添加!') . '",_:null}';
                 exit;
             }
             $data['tag_type'] = $this->object->table_name();
             $data['tag_name'] = $tag_name[$key];
             $data['app_id'] = $this->app->app_id;
             $tagctl->save($data);
             logger::emerg('---' . var_export($data, true));
             logger::emerg('---xx' . var_export($pkey, true));
             if ($data['tag_id']) {
                 $data2['tag']['tag_id'] = $data['tag_id'];
                 unset($data['tag_id']);
                 foreach ($pkey as $id) {
                     $data2['tag_type'] = $this->object->table_name();
                     $data2['app_id'] = $this->app->app_id;
                     $data2['rel_id'] = $id;
                     //save修改了data tag_id的位置 edit by jiaolei time:2010-11-17 mantis:0019313
                     $data2['tag']['tag_id'] or $data2['tag']['tag_id'] = $data2['tag_id'];
                     logger::emerg("===" . var_export($data2, true));
                     $tag_rel->save($data2);
                 }
             }
         }
     }
     //header('Content-Type:application/json; charset=utf-8');
     $res['success'] = app::get('desktop')->_('標簽設置成功');
     return response::json($res);
 }
開發者ID:453111208,項目名稱:bbc,代碼行數:71,代碼來源:settag.php

示例4: stopFrontendCrawler

 /**
  * @static
  * @param bool $playNice
  * @return bool
  */
 public static function stopFrontendCrawler($playNice = true, $isFrontendCall = false)
 {
     logger::debug("SearchPhp_Plugin: forcing frontend crawler stop, play nice: [ {$playNice} ]");
     self::setStopLock("frontend", true);
     //just to make sure nothing else starts the crawler right now
     self::setCrawlerState("frontend", "started", false);
     $configArray = self::getSearchConfigArray();
     $maxThreads = $configArray['search']['frontend']['crawler']['maxThreads'];
     $db = Pimcore_Resource_Mysql::get();
     $db->query("DROP TABLE IF EXISTS `plugin_searchphp_frontend_crawler_todo`;");
     $db->query("DROP TABLE IF EXISTS `plugin_searchphp_indexer_todo`;");
     logger::debug("SearchPhp_Plugin: forcing frontend crawler stop - dropped tables");
     sleep(1);
     $pidFiles = array("maintainance_crawler-indexer");
     for ($i = 1; $i <= $maxThreads; $i++) {
         $pidFiles[] = "maintainance_crawler-" . $i;
     }
     $counter = 1;
     while ($pidFiles and count($pidFiles) > 0 and $counter < 10) {
         sort($pidFiles);
         for ($i = 0; $i < count($pidFiles); $i++) {
             $file = PIMCORE_SYSTEM_TEMP_DIRECTORY . "/" . $pidFiles[$i];
             if (!is_file($file)) {
                 unset($pidFiles[$i]);
             }
         }
         sleep(1);
         $counter++;
     }
     if (!$playNice) {
         if (is_file(PIMCORE_SYSTEM_TEMP_DIRECTORY . "/maintainance_SearchPhp_Plugin.pid" and $isFrontendCall)) {
             $pidFiles[] = "maintainance_SearchPhp_Plugin.pid";
         }
         //delete pid files of all  processes
         for ($i = 0; $i < count($pidFiles); $i++) {
             $file = PIMCORE_SYSTEM_TEMP_DIRECTORY . "/" . $pidFiles[$i];
             if (is_file($file) and !unlink($file)) {
                 logger::emerg("SearchPhp_Plugin: : Trying to force stop crawler, but cannot delete [ {$file} ]");
             }
             if (!is_file($file)) {
                 unset($pidFiles[$i]);
             }
         }
     }
     self::setStopLock("frontend", false);
     if (!$pidFiles or count($pidFiles) == 0) {
         self::setCrawlerState("frontend", "finished", false);
         return true;
     }
     return false;
 }
開發者ID:weblizards-gmbh,項目名稱:search-php,代碼行數:56,代碼來源:Plugin.php

示例5: generateSitemap

 /**
  * @return void
  */
 public static function generateSitemap()
 {
     $sitemapDir = PIMCORE_WEBSITE_PATH . "/var/search/sitemap";
     if (is_dir($sitemapDir) and !is_writable($sitemapDir)) {
         $sitemapDirAvailable = false;
     } else {
         if (!is_dir($sitemapDir)) {
             $sitemapDirAvailable = mkdir($sitemapDir, 0755, true);
             chmod($sitemapDir, 0755);
         } else {
             $sitemapDirAvailable = true;
         }
     }
     if ($sitemapDirAvailable) {
         $db = Pimcore_Resource_Mysql::get();
         $hosts = $db->fetchAll("SELECT DISTINCT host from plugin_searchphp_contents");
         if (is_array($hosts)) {
             //create domain sitemaps
             foreach ($hosts as $row) {
                 $host = $row['host'];
                 $data = $db->fetchAll("SELECT * FROM plugin_searchphp_contents WHERE host = '" . $host . "' AND content != 'canonical' AND content!='noindex' ORDER BY uri", array());
                 $name = str_replace(".", "-", $host);
                 $filePath = $sitemapDir . "/sitemap-" . $name . ".xml";
                 $fh = fopen($filePath, 'w');
                 fwrite($fh, '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n");
                 fwrite($fh, '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
                 fwrite($fh, "\r\n");
                 foreach ($data as $row) {
                     $uri = str_replace("&pimcore_outputfilters_disabled=1", "", $row['uri']);
                     $uri = str_replace("?pimcore_outputfilters_disabled=1", "", $uri);
                     fwrite($fh, '<url>' . "\r\n");
                     fwrite($fh, '    <loc>' . htmlspecialchars($uri, ENT_QUOTES) . '</loc>' . "\r\n");
                     fwrite($fh, '</url>' . "\r\n");
                 }
                 fwrite($fh, '</urlset>' . "\r\n");
                 fclose($fh);
             }
             //create sitemap index file
             $filePath = $sitemapDir . "/sitemap.xml";
             $fh = fopen($filePath, 'w');
             fwrite($fh, '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n");
             fwrite($fh, '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
             fwrite($fh, "\r\n");
             foreach ($hosts as $row) {
                 $host = $row['host'];
                 $name = str_replace(".", "-", $host);
                 //first host must be main domain - see hint in plugin settings
                 $currenthost = $hosts[0]['host'];
                 fwrite($fh, '<sitemap>' . "\r\n");
                 fwrite($fh, '    <loc>http://' . $currenthost . "/plugin/SearchPhp/frontend/sitemap/?sitemap=sitemap-" . $name . ".xml" . '</loc>' . "\r\n");
                 fwrite($fh, '</sitemap>' . "\r\n");
             }
             fwrite($fh, '</sitemapindex>' . "\r\n");
             fclose($fh);
         } else {
             logger::warn("SearchPhp_Tool: could not generate sitemaps, did not find any hosts in index.");
         }
     } else {
         logger::emerg("SearchPhp_Tool: Cannot generate sitemap. Sitemap directory [ " . $sitemapDir . " ]  not available/not writeable and cannot be created");
     }
 }
開發者ID:weblizards-gmbh,項目名稱:search-php,代碼行數:64,代碼來源:Tool.php


注:本文中的logger::emerg方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。