mirror of
https://github.com/friendica/friendica
synced 2024-12-22 23:20:16 +00:00
Use a process identifier for logging that contains the pid (#5359)
This commit is contained in:
parent
ef0e34adf3
commit
3792e2819d
3 changed files with 15 additions and 3 deletions
|
@ -193,7 +193,7 @@ class App
|
|||
|
||||
$this->query_string = '';
|
||||
|
||||
$this->process_id = uniqid('log', true);
|
||||
$this->process_id = System::processID('log');
|
||||
|
||||
set_time_limit(0);
|
||||
|
||||
|
|
|
@ -203,6 +203,18 @@ EOT;
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a process identifier for the logging
|
||||
*
|
||||
* @param string $prefix A given prefix
|
||||
*
|
||||
* @return string a generated process identifier
|
||||
*/
|
||||
public static function processID($prefix)
|
||||
{
|
||||
return uniqid($prefix . ':' . str_pad(getmypid() . ':', 8, '0') . ':');
|
||||
}
|
||||
|
||||
/// @todo Move the following functions from boot.php
|
||||
/*
|
||||
function killme()
|
||||
|
|
|
@ -141,7 +141,7 @@ class Worker
|
|||
if (Config::get('system', 'worker_daemon_mode', false)) {
|
||||
self::IPCSetJobState(false);
|
||||
}
|
||||
logger("Couldn't select a workerqueue entry, quitting.", LOGGER_DEBUG);
|
||||
logger("Couldn't select a workerqueue entry, quitting process " . getmypid() . ".", LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -309,7 +309,7 @@ class Worker
|
|||
|
||||
$argc = count($argv);
|
||||
|
||||
$new_process_id = uniqid("wrk", true);
|
||||
$new_process_id = System::processID("wrk");
|
||||
|
||||
logger("Process ".$mypid." - Prio ".$queue["priority"]." - ID ".$queue["id"].": ".$funcname." ".$queue["parameter"]." - Process PID: ".$new_process_id);
|
||||
|
||||
|
|
Loading…
Reference in a new issue