本文整理汇总了PHP中Zend_Log::info方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Log::info方法的具体用法?PHP Zend_Log::info怎么用?PHP Zend_Log::info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Log
的用法示例。
在下文中一共展示了Zend_Log::info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testWrite
public function testWrite()
{
$this->log->err('123');
$this->log->info('123');
$count = $this->rediska->getListLength('log');
$this->assertEquals(2, $count);
}
示例2: queryStart
/**
* Obsługa rozpoczęcia kwerendy .
*
* @param type $queryText
* @param type $queryType
* @return type
*/
public function queryStart($queryText, $queryType = null)
{
$queryId = parent::queryStart($queryText);
if ($this->getEnabled()) {
$message = "SQL({$queryId}): " . $queryText;
// log the message as INFO message
$this->_log->info($message);
}
return $queryId;
}
示例3: __construct
/**
*
* @throws Opus_SolrSearch_Exception If connection to Solr server could not be established.
*/
public function __construct()
{
$this->log = Zend_Registry::get('Zend_Log');
$this->config = Zend_Registry::get('Zend_Config');
$this->solr_server = $this->getSolrServer();
if (false === $this->solr_server->ping()) {
$this->log->err('Connection to Solr server ' . $this->solr_server_url . ' could not be established.');
throw new Opus_SolrSearch_Exception('Solr server ' . $this->solr_server_url . ' is not responding.', Opus_SolrSearch_Exception::SERVER_UNREACHABLE);
}
$this->log->info('Connection to Solr server ' . $this->solr_server_url . ' was successfully established.');
}
示例4: addItem
public static function addItem($message, $error = false)
{
global $s1b;
if (self::getConfig()->getTracesEnabled() || self::getConfig()->getLogsEnabled()) {
if (!strlen(trim($message))) {
throw new \Exception('Cannot insert empty trace.');
}
// Ecriture du message dans le tableau des items en sessions si traces activées
if (self::getConfig()->getTracesEnabled()) {
self::initItems();
self::$items[] = $message;
}
// Ecriture du log si activé
if (self::getConfig()->getLogsEnabled()) {
// vérification de l'existence du fichier et création si non existant
$now = new \DateTime();
$logFilePath = self::getContext()->getBaseDirectory() . sprintf("/var/log/%s-log.txt", $now->format("Ymd"));
if (!file_exists($logFilePath)) {
$file = fopen($logFilePath, "w");
fclose($file);
}
// ecriture du log dans le fichier
$writer = new \Zend_Log_Writer_Stream($logFilePath);
$logger = new \Zend_Log($writer);
if ($error) {
$logger->err($message);
} else {
$logger->info($message);
}
$logger = null;
}
}
}
示例5: queryEnd
/**
* Intercept the query end and log the profiling data.
*
* @param integer $queryId
* @throws Zend_Db_Profiler_Exception
* @return void
*/
public function queryEnd($queryId)
{
$state = parent::queryEnd($queryId);
if (!$this->getEnabled() || $state == self::IGNORED) {
return;
}
// get profile of the current query
$profile = $this->getQueryProfile($queryId);
// update totalElapsedTime counter
$this->_totalElapsedTime += $profile->getElapsedSecs();
// create the message to be logged
$message = "\nElapsed Secs: " . round($profile->getElapsedSecs(), 5) . "\n";
$message .= "Query: " . $profile->getQuery() . "\n";
// log the message as INFO message
$this->_log->info($message);
}
示例6: work
/**
* Load a document from database and optional file(s) and index them,
* or remove document from index (depending on job)
*
* @param Opus_Job $job Job description and attached data.
* @return void
*/
public function work(Opus_Job $job)
{
// make sure we have the right job
if ($job->getLabel() != $this->getActivationLabel()) {
throw new Opus_Job_Worker_InvalidJobException($job->getLabel() . " is not a suitable job for this worker.");
}
$this->_job = $job;
$data = $job->getData();
if (!(is_object($data) && isset($data->documentId) && isset($data->task))) {
throw new Opus_Job_Worker_InvalidJobException("Incomplete or missing data.");
}
if (null !== $this->_logger) {
$this->_logger->info('Indexing document with ID: ' . $data->documentId . '.');
}
// create index document or remove index, depending on task
if ($data->task === 'index') {
$document = new Opus_Document($data->documentId);
$this->getIndex()->addDocumentToEntryIndex($document)->commit();
} else {
if ($data->task === 'remove') {
$this->getIndex()->removeDocumentFromEntryIndexById($data->documentId)->commit();
} else {
throw new Opus_Job_Worker_InvalidJobException("unknown task '{$data->task}'.");
}
}
}
示例7: consume
/**
* Execute a job and remove it from the jobs table on success.
*
* @param Opus_Job $job Job description model.
* @return boolean Returns true if a job is consumend false if not
*/
protected function consume(Opus_Job $job)
{
$label = $job->getLabel();
if ($job->getState() !== null) {
return false;
}
if (array_key_exists($label, $this->_workers)) {
$worker = $this->_workers[$label];
if (null !== $this->_logger) {
$this->_logger->info('Processing ' . $label);
}
$job->setState(Opus_Job::STATE_PROCESSING);
$job->store();
try {
$worker->setLogger($this->_logger);
$worker->work($job);
$job->delete();
sleep($this->_delay);
} catch (Exception $ex) {
if (null !== $this->_logger) {
$msg = get_class($worker) . ': ' . $ex->getMessage();
$this->_logger->err($msg);
}
$job->setErrors(json_encode(array('exception' => get_class($ex), 'message' => $ex->getMessage(), 'trace' => $ex->getTraceAsString())));
$job->setState(Opus_Job::STATE_FAILED);
$job->store();
return false;
}
return true;
}
return false;
}
示例8: init
public function init()
{
$writer = new Zend_Log_Writer_Firebug();
$logger = new Zend_Log($writer);
$logger->addPriority('LOGD', 8);
$writer->setPriorityStyle(8, 'LOG');
$logger->addPriority('ERROR', 9);
$writer->setPriorityStyle(9, 'ERROR');
$logger->addPriority('TRACE', 10);
$writer->setPriorityStyle(10, 'TRACE');
$logger->addPriority('EXCEPTION', 11);
$writer->setPriorityStyle(11, 'EXCEPTION');
$logger->addPriority('TABLE', 12);
$writer->setPriorityStyle(12, 'TABLE');
$logger->logd($_SERVER);
$logger->info($_SERVER);
$logger->warn($_SERVER);
$logger->error($_SERVER);
$logger->trace($_SERVER);
try {
throw new Exception('Test Exception');
} catch (Exception $e) {
$logger->exception($e);
}
$logger->table(array('2 SQL queries took 0.06 seconds', array(array('SQL Statement', 'Time', 'Result'), array('SELECT * FROM Foo', '0.02', array('row1', 'row2')), array('SELECT * FROM Bar', '0.04', array('row1', 'row2')))));
}
示例9: _error
protected function _error($message)
{
$writer = new Zend_Log_Writer_Stream(APPLICATION_PATH . '/../data/log/cron_ERROR_' . $this->_name . '.log');
$logger = new Zend_Log($writer);
echo $message;
$logger->info($message . "\n");
return;
}
示例10: _sendMessage
/**
* Send message to queue
*
* @param Oggetto_Messenger_Model_Message_Interface $message Message
* @param string $queue Queue
*
* @return void
*/
private function _sendMessage(Oggetto_Messenger_Model_Message_Interface $message, $queue)
{
$rabbitMessage = new AMQPMessage($message->toString(), array('delivery_mode' => 2));
$this->_logger->info("Sending message to queue '{$queue}': {$rabbitMessage->body}");
$transport = new Varien_Object();
Mage::dispatchEvent('rabbitmq_publish_before', ['message' => $rabbitMessage, 'transport' => $transport]);
$this->_getChannel()->basic_publish($rabbitMessage, '', $queue);
Mage::dispatchEvent('rabbitmq_publish_after', ['message' => $rabbitMessage, 'transport' => $transport]);
}
示例11: X_initDbCaches
/**
* Init the db metadata and paginator caches
*/
protected function X_initDbCaches()
{
$this->_logger->info('Bootstrap ' . __METHOD__);
if ('production' == $this->getEnvironment()) {
// Metadata cache for Zend_Db_Table
$frontendOptions = array('automatic_serialization' => true);
$cache = Zend_Cache::factory('Core', 'Apc', $frontendOptions);
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
}
}
示例12: getLogger
/**
* lees de opties uit application.ini en maak een log-object aan dat in de
* registry wordt gezet. Deze is vanuit de hele code te gebruiken voor debug-logging
* @return Zend_Log
*/
public function getLogger()
{
if (null === $this->_logger) {
$options = $this->getOptions();
if (!isset($options['debuglog'])) {
throw new Exception("Debug log path undefined in application.ini");
}
try {
$writer = new Zend_Log_Writer_Stream($options['debuglog']);
$this->_logger = new Zend_Log($writer);
} catch (Exception $e) {
$this->_logger = null;
}
if (isset($options['firebug']) && "1" == $options['firebug']) {
try {
$writer = new Zend_Log_Writer_Firebug();
if (null !== $this->_logger) {
$this->_logger->addWriter($writer);
} else {
$this->_logger = new Zend_Log($writer);
}
} catch (Exception $e) {
$this->_logger = null;
}
}
// voeg eventueel een uitvoer filter toe
if (null !== $this->_logger && isset($options['loglevel'])) {
try {
$loglevel = intVal($options['loglevel']);
$filter = new Zend_Log_Filter_Priority($loglevel);
$this->_logger->addFilter($filter);
} catch (Exception $e) {
}
}
}
// voeg toe aan de registry zodat we deze later eenvoudig kunnen gebruiken
if (null !== $this->_logger) {
$this->_logger->info('==========================================================');
Zend_Registry::set('logger', $this->_logger);
}
return $this->_logger;
}
示例13: deleteDocsByQuery
/**
* Deletes all index documents that match the given query $query. The
* changes are not visible and a subsequent call to commit is required, to
* make the changes visible.
*
* @param query
* @throws Opus_SolrSearch_Index_Exception If delete by query $query failed.
* @return void
*/
public function deleteDocsByQuery($query)
{
try {
$this->getSolrServer('index')->deleteByQuery($query);
$this->log->info('deleted all docs that match ' . $query);
} catch (Apache_Solr_Exception $e) {
$msg = 'Error while deleting all documents that match query ' . $query;
$this->log->err("{$msg} : " . $e->getMessage());
throw new Opus_SolrSearch_Index_Exception($msg, 0, $e);
}
}
示例14: saveCdrDedicatorias
public function saveCdrDedicatorias($resultado)
{
$name = date('YmdH');
$datos = $this->registerCdr();
$writer = new Zend_Log_Writer_Stream(APPLICATION_PATH . '/../logs/cdr/' . $name . ".dedicatoria");
$formatter = new Zend_Log_Formatter_Simple('%message%' . PHP_EOL);
$writer->setFormatter($formatter);
$log = new Zend_Log($writer);
$mensaje = $datos['fecha'] . "," . $datos['hora'] . "," . $_SERVER['REMOTE_ADDR'] . "," . $datos['telefono'] . "," . 'perfil:' . $datos['perfil'] . "," . $resultado;
$log->info($mensaje);
}
示例15: saveCdrBanners
private function saveCdrBanners($datos, $id, $name)
{
$writer = new Zend_Log_Writer_Stream(APPLICATION_PATH . '/../logs/cdr/' . $name . ".banners");
// $writer = new Zend_Log_Writer_Stream('/var/log/portalwap/'.$name.".banners");
$formatter = new Zend_Log_Formatter_Simple('%message%' . PHP_EOL);
$writer->setFormatter($formatter);
$log = new Zend_Log($writer);
$banners = 'banner1.' . $datos['url'][0] . "," . 'banner2.' . $datos['url'][1] . "," . 'banner3.' . $datos['url'][2] . "," . 'banner4.' . $datos['url'][3] . "," . 'banner5.' . $datos['url'][4];
$mensaje = $datos['fecha'] . "," . $datos['hora'] . "," . $_SERVER['REMOTE_ADDR'] . "," . $datos['telefono'] . ",perfil:" . $datos['perfil'] . "," . $banners;
$log->info($mensaje);
}