本文整理汇总了PHP中error_log函数的典型用法代码示例。如果您正苦于以下问题:PHP error_log函数的具体用法?PHP error_log怎么用?PHP error_log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了error_log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sync_object
function sync_object($object_type, $object_name)
{
# Should only provide error information on stderr: put stdout to syslog
$cmd = "geni-sync-wireless {$object_type} {$object_name}";
error_log("SYNC(cmd) " . $cmd);
$descriptors = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"));
$process = proc_open($cmd, $descriptors, $pipes);
$std_output = stream_get_contents($pipes[1]);
# Should be empty
$err_output = stream_get_contents($pipes[2]);
fclose($pipes[1]);
fclose($pipes[2]);
$proc_value = proc_close($process);
$full_output = $std_output . $err_output;
foreach (split("\n", $full_output) as $line) {
if (strlen(trim($line)) == 0) {
continue;
}
error_log("SYNC(output) " . $line);
}
if ($proc_value != RESPONSE_ERROR::NONE) {
error_log("WIRELESS SYNC error: {$proc_value}");
}
return $proc_value;
}
示例2: import
/**
*
* @param array $current_import
* @return bool
*/
function import(array $current_import)
{
// fetch the remote content
$html = wp_remote_get($current_import['file']);
// Something failed
if (is_wp_error($html)) {
$redirect_url = get_admin_url(get_current_blog_id(), '/tools.php?page=pb_import');
error_log('\\PressBooks\\Import\\Html import error, wp_remote_get() ' . $html->get_error_message());
$_SESSION['pb_errors'][] = $html->get_error_message();
$this->revokeCurrentImport();
\Pressbooks\Redirect\location($redirect_url);
}
$url = parse_url($current_import['file']);
// get parent directory (with forward slash e.g. /parent)
$path = dirname($url['path']);
$domain = $url['scheme'] . '://' . $url['host'] . $path;
// get id (there will be only one)
$id = array_keys($current_import['chapters']);
// front-matter, chapter, or back-matter
$post_type = $this->determinePostType($id[0]);
$chapter_parent = $this->getChapterParent();
$body = $this->kneadandInsert($html['body'], $post_type, $chapter_parent, $domain);
// Done
return $this->revokeCurrentImport();
}
示例3: cpanel
public function cpanel()
{
$whmusername = "root";
$whmhash = "somelonghash";
# some hash value
$query = "https://127.0.0.1:2087/....";
$curl = curl_init();
# Create Curl Object
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
# Allow certs that do not match the domain
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
# Allow self-signed certs
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
# Return contents of transfer on curl_exec
$header[0] = "Authorization: WHM {$whmusername}:" . preg_replace("'(\r|\n)'", "", $whmhash);
# Remove newlines from the hash
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
# Set curl header
curl_setopt($curl, CURLOPT_URL, $query);
# Set your URL
$result = curl_exec($curl);
# Execute Query, assign to $result
if ($result == false) {
error_log("curl_exec threw error \"" . curl_error($curl) . "\" for {$query}");
}
curl_close($curl);
print $result;
}
示例4: updateDatabase
/**
* Remove the record IF there are no records referencing this user.
*/
function updateDatabase($form, $myvalues)
{
//Perform some data quality checks now.
if (!isset($myvalues['protocol_shortname'])) {
die("Cannot delete record because missing protocol_shortname in array!\n" . var_dump($myvalues));
}
$updated_dt = date("Y-m-d H:i", time());
$protocol_shortname = $myvalues['protocol_shortname'];
//Backup all the existing records.
$this->m_oPageHelper->copyProtocolLibToReplacedTable($protocol_shortname);
$this->m_oPageHelper->copyKeywordsToReplacedTable($protocol_shortname);
$this->m_oPageHelper->copyTemplateValuesToReplacedTable($protocol_shortname);
//Delete all the records.
$num_deleted = db_delete('raptor_protocol_lib')->condition('protocol_shortname', $protocol_shortname)->execute();
$num_deleted = db_delete('raptor_protocol_keywords')->condition('protocol_shortname', $protocol_shortname)->execute();
$num_deleted = db_delete('raptor_protocol_template')->condition('protocol_shortname', $protocol_shortname)->execute();
//Success?
if ($num_deleted == 1) {
$feedback = 'The ' . $protocol_shortname . ' protocol has been succesfully deleted.';
drupal_set_message($feedback);
return 1;
}
//We are here because we failed.
$feedback = 'Trouble deleting ' . $protocol_shortname . ' protocol!';
error_log($feedback . ' delete reported ' . $num_deleted);
drupal_set_message($feedback, 'warning');
return 0;
}
示例5: printStackTrace
/**
* Prints the stack trace for this exception.
*/
public function printStackTrace()
{
if (null === $this->wrappedException) {
$this->setWrappedException($this);
}
$exception = $this->wrappedException;
if (!sfConfig::get('sf_test')) {
// log all exceptions in php log
error_log($exception->getMessage());
// clean current output buffer
while (ob_get_level()) {
if (!ob_end_clean()) {
break;
}
}
ob_start(sfConfig::get('sf_compressed') ? 'ob_gzhandler' : '');
header('HTTP/1.0 500 Internal Server Error');
}
try {
$this->outputStackTrace($exception);
} catch (Exception $e) {
}
if (!sfConfig::get('sf_test')) {
exit(1);
}
}
示例6: GoogleLog
/**
* SetLogFiles
*/
function GoogleLog($errorLogFile, $messageLogFile, $logLevel = L_ERR_RQST, $die = true)
{
$this->logLevel = $logLevel;
if ($logLevel == L_OFF) {
$this->logLevel = L_OFF;
} else {
if (!($this->errorLogFile = @fopen($errorLogFile, "a"))) {
header('HTTP/1.0 500 Internal Server Error');
$log = "Cannot open " . $errorLogFile . " file.\n" . "Logs are not writable, set them to 777";
error_log($log, 0);
if ($die) {
die($log);
} else {
echo $log;
$this->logLevel = L_OFF;
}
}
if (!($this->messageLogFile = @fopen($messageLogFile, "a"))) {
fclose($this->errorLogFile);
header('HTTP/1.0 500 Internal Server Error');
$log = "Cannot open " . $messageLogFile . " file.\n" . "Logs are not writable, set them to 777";
error_log($log, 0);
if ($die) {
die($log);
} else {
echo $log;
$this->logLevel = L_OFF;
}
}
}
$this->logLevel = $logLevel;
}
示例7: prepareSubmitData
protected function prepareSubmitData($key)
{
$var = $this->getArg($key, array());
if (!$type = $this->getArg('_type')) {
error_log("Type data not found");
return $var;
}
if (!is_array($var)) {
$type = isset($type[$key]) ? $type[$key] : null;
return $this->prepareSubmitValue($var, $type);
} elseif (!isset($type[$key])) {
error_log("Type data not found for $key");
return $var;
}
$types = $type[$key];
foreach ($types as $key=>$type) {
if (is_array($type)) {
foreach ($type as $_key=>$_type) {
$value = isset($var[$key][$_key]) ? $var[$key][$_key] : null;
$var[$key][$_key] = $this->prepareSubmitValue($value, $_type);
}
} else {
$value = isset($var[$key]) ? $var[$key] : null;
$var[$key] = $this->prepareSubmitValue($value, $type);
}
}
return $var;
}
示例8: service
public function service($request, $response)
{/*{{{*/
ob_start();
$result = $this->callCenterApi->returnSuccess();
$function = $request->service;
if(method_exists($this, $function))
{
try
{
$lockName = $this->getLockerName($request);
$cacher= DAL::get()->getCache(Cacher::CACHETYPE_LOCKER);
$locker = LockUtil::factory(LockUtil::LOCK_TYPE_MEMCACHE, array('memcache' => $cacher));
$locker->getLock($lockName);
$result = $this->$function($request,$response);
$locker->releaseLock($lockName);
}
catch(LockException $ex)
{
error_log(XDateTime::now()->toString()."并发锁错误 $lockName\n", 3 , $this->logFileName);
}
catch(Exception $ex)
{
error_log(XDateTime::now()->toString()."释放锁 $lockName\n", 3 , $this->logFileName);
$locker->releaseLock($lockName);
}
}
echo $result;
$this->logTxt .= XDateTime::now()->toString().'--->'.print_r($result, true)."\n";
header('Content-Length: ' . ob_get_length());
return parent::DIRECT_OUTPUT;
}/*}}}*/
示例9: log2file
/**
* Formatea y guarda el mensaje en el archivo de log. Además se le agrega la fecha y hora
* y un salto de linea
*
* @access public
* @param $message (string) mensaje a logear
* @return void
*/
function log2file($message)
{
// Agregar la fecha y hora en la cual ocurrió en error
$fecha = date('d/m/Y H:i:s');
$message = $fecha . ';' . $message . "\r\n";
error_log($message, 3, $this->filename);
}
示例10: raise
function raise($e_message) {
global $page;
array_push($this->e_list, $e_message);
error_log("StreamOnTheFly error: $msg", 0);
$page->halt();
exit;
}
示例11: log_errors
public static function log_errors($msg = null, $strip = false)
{
if (defined('LOG_XPM4_ERRORS')) {
if (is_string(LOG_XPM4_ERRORS) && is_string($msg) && is_bool($strip)) {
if (is_array($arr = unserialize(LOG_XPM4_ERRORS)) && isset($arr['type']) && is_int($arr['type']) && ($arr['type'] == 0 || $arr['type'] == 1 || $arr['type'] == 3)) {
$msg = "\r\n" . '[' . date('m-d-Y H:i:s') . '] XPM4 ' . ($strip ? str_replace(array('<br />', '<b>', '</b>', "\r\n"), '', $msg) : $msg);
if ($arr['type'] == 0) {
error_log($msg);
} else {
if ($arr['type'] == 1 && isset($arr['destination'], $arr['headers']) && is_string($arr['destination']) && strlen(trim($arr['destination'])) > 5 && count(explode('@', $arr['destination'])) == 2 && is_string($arr['headers']) && strlen(trim($arr['headers'])) > 3) {
error_log($msg, 1, trim($arr['destination']), trim($arr['headers']));
} else {
if ($arr['type'] == 3 && isset($arr['destination']) && is_string($arr['destination']) && strlen(trim($arr['destination'])) > 1) {
error_log($msg, 3, trim($arr['destination']));
} else {
if (defined('DISPLAY_XPM4_ERRORS') && DISPLAY_XPM4_ERRORS == true) {
trigger_error('invalid LOG_XPM4_ERRORS constant value', E_USER_WARNING);
}
}
}
}
} else {
if (defined('DISPLAY_XPM4_ERRORS') && DISPLAY_XPM4_ERRORS == true) {
trigger_error('invalid LOG_XPM4_ERRORS constant type', E_USER_WARNING);
}
}
} else {
if (defined('DISPLAY_XPM4_ERRORS') && DISPLAY_XPM4_ERRORS == true) {
trigger_error('invalid parameter(s) type', E_USER_WARNING);
}
}
}
}
示例12: cachableDataset
static function cachableDataset($n)
{
$flg_exit = false;
/*
if(isset($_SESSION['cache_' . $n ])){
$gmdate_mod = $_SESSION['cache_' . $n ];
$flg_exit = true;
}else{
$gmdate_mod = gmdate('D, d M Y H:i:s') . ' GMT';
$_SESSION['cache_' . $n ] = $gmdate_mod;
}
*/
$gmdate_mod = gmdate('D, d M Y H:i:s') . ' GMT';
header("HTTP/1.1 304 Not Modified");
header("Date: {$gmdate_mod}");
header("Last-Modified: {$gmdate_mod}");
header("Cache-Control: public, max-age=86400, must-revalidate");
header("Pragma: cache");
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 86400) . ' GMT');
error_log("============ Called cachableDataset {$n} {$gmdate_mod} ==========================================");
if ($flg_exit) {
exit;
}
error_log("============ Creating cachableDataset {$n} {$gmdate_mod} ==========================================");
$a = new rea_ui_dataset();
return $a;
}
示例13: debug
public static function debug($str, $level = false)
{
if (self::$debug) {
error_log($str);
}
//Z_Log::log(Z_CONFIG::$LOG_TARGET_DEFAULT, $str);
}
示例14: validate
public function validate()
{/*{{{*/
$msg = '';
foreach ($this->dbreads as $dbread){
$link = mysql_connect($dbread['host'], $this->account['user'], $this->account['pass']);
$res = mysql_query('show slave status', $link);
$row = mysql_fetch_assoc($res);
if (empty($row)) {
$msg .= $dbread['host'].' can\'t be connected;';
} else if ($this->max < $row['Seconds_Behind_Master']) {
error_log("\n".date('Y-m-d H:i:s').":\n".print_r($row, true), 3, '/tmp/db.log');
$msg .= $dbread['host'].' delay '.$row['Seconds_Behind_Master'].';';
} else if ('' != $row['Last_Error']) {
$msg .= $dbread['host'].' has error!';
} else if ('Yes' != $row['Slave_IO_Running'] || 'Yes' != $row['Slave_SQL_Running']) {
$msg .= $dbread['host'].' has repl error!';
} else if ('' != $row['Last_IO_Error']) {
$msg .= $dbread['host'].' has io error!';
} else if ('' != $row['Last_SQL_Error']) {
$msg .= $dbread['host'].' has sql error!';
}
mysql_close($link);
}
return $msg;
}/*}}}*/
示例15: __toString
/**
* Print a warning, as a call to this function means that $SIMPLESAML_INCPREFIX is referenced.
*
* @return A blank string.
*/
function __toString()
{
$backtrace = debug_backtrace();
$where = $backtrace[0]['file'] . ':' . $backtrace[0]['line'];
error_log('Deprecated $SIMPLESAML_INCPREFIX still in use at ' . $where . '. The simpleSAMLphp library now uses an autoloader.');
return '';
}