logFile

Description:

static string Worker::$logFile

Used to specify the location of the workerman log file.

This file records logs related to workerman itself, including startup, shutdown, and so on.

If not set, the default filename is workerman.log, and the file location is in the parent directory of Workerman.

Note:

This log file only records logs related to workerman's own startup and shutdown, and does not include any business logs.

Business log classes can implement their own logging using functions like file_put_contents or error_log.

Example

use Workerman\Worker;
require_once __DIR__ . '/vendor/autoload.php';

Worker::$logFile = '/tmp/workerman.log';

$worker = new Worker('text://0.0.0.0:8484');
$worker->onWorkerStart = function($worker)
{
    echo "Worker start";
};
// Run worker
Worker::runAll();