Giter Site home page Giter Site logo

Child Process' STDOUT about workerman HOT 4 CLOSED

walkor avatar walkor commented on May 12, 2024
Child Process' STDOUT

from workerman.

Comments (4)

walkor avatar walkor commented on May 12, 2024

You can redirect STDOUT into a file like this.
Support only in daemon mode and command like php your_file.php start -d.

use Workerman\Worker;
require_once './Workerman/Autoloader.php';

Worker::$daemonize = true;

// All output will be redirected to /tmp/stdout.log
Worker::$stdoutFile = '/tmp/stdout.log';

$worker = new Worker('Text://0.0.0.0:8484');
$worker->on{...} = function(){...

// Run all workers
Worker::runAll();

More informations see https://github.com/walkor/workerman-manual/blob/master/english/src/worker-development/stdout_file.md

from workerman.

IngwiePhoenix avatar IngwiePhoenix commented on May 12, 2024

And how can I get this working in a non-deamonized mode? The Workerman process is managed via NodeJS. The entry point for Workerman: https://github.com/DragonsInn/BIRD3/blob/master/php-lib/request_handler.php

from workerman.

walkor avatar walkor commented on May 12, 2024

You can also redirect STDOUT into a file like this.

global $STDOUT, $STDERR;
$stdfile = '/your/path/stdfile';
@fclose(STDOUT);
@fclose(STDERR);
$STDOUT = fopen($stdfile,"a");
$STDERR = fopen($stdfile,"a");

from workerman.

IngwiePhoenix avatar IngwiePhoenix commented on May 12, 2024

I am redirecting using php://stdout php://stdout now. I need to test this more but so far, no error was thrown! :)

from workerman.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.