两个实例的stdoutFile和logFile都写在了同一个里面

nbyang

同一个项目运行了两个实例, 分别设置了stdoutFile和logFile, 但是实际运行中发现不管是var_dump还是报错信息, 写入到了同一个文件里面. 是不是和$worker->eventHandler一样需要指定?

程序代码或配置

实例A 的start_businessworker

use GatewayWorker\BusinessWorker;
use Workerman\WebServer;
use Workerman\Worker;

// 自动加载类
require_once __DIR__.'/../../vendor/autoload.php';
// bussinessWorker 进程
$worker = new BusinessWorker();
// worker名称
$worker->name = 'A_BusinessWorker';
// bussinessWorker进程数量
$worker->count = 6;
// 服务注册地址
$worker->registerAddress = '127.0.0.1:1235';
$worker->eventHandler = '\Applications\Worker_a\Events';

Worker::$stdoutFile = __DIR__ .'/stdout_a.log';
Worker::$logFile = __DIR__ .'/workerman_a.log';

// 如果不是在根目录启动,则运行runAll方法
if (!defined('GLOBAL_START')) {
    Worker::runAll();
}

实例A 的start_businessworker

use GatewayWorker\BusinessWorker;
use Workerman\WebServer;
use Workerman\Worker;

// 自动加载类
require_once __DIR__.'/../../vendor/autoload.php';
// bussinessWorker 进程
$worker = new BusinessWorker();
// worker名称
$worker->name = 'B_BusinessWorker';
// bussinessWorker进程数量
$worker->count = 6;
// 服务注册地址
$worker->registerAddress = '127.0.0.1:1238';
$worker->eventHandler = '\Applications\Worker_b\Events';

Worker::$stdoutFile = __DIR__ .'/stdout_b.log';
Worker::$logFile = __DIR__ .'/workerman_b.log';

// 如果不是在根目录启动,则运行runAll方法
if (!defined('GLOBAL_START')) {
    Worker::runAll();
}

debian11 GatewayWorker3.1.0 php8.2.4+event

572 1 0
1个回答

walkor 打赏

一个启动脚本的stdoutFile和logFile只有一个生效

年代过于久远,无法发表回答
×
🔝