log icon indicating copy to clipboard operation
log copied to clipboard

StreamHandler: Missing close() method

Open Fneufneu opened this issue 1 year ago • 1 comments

Hi,

When i rotate my log, i send a SIGHUP signal to inform my daemon so i can $logger->close() and force Monolog to free and reopen all handlers. But the class Amp\Log\StreamHandler miss the close() method, the write method does not check the validity of the stream before writting, and StreamHandler cannot close and reopen a stream.

Workaround: i remove the StreamHandler from handlers and make a new one. But the stream is not closed (lsof show my old log is still opened by php)

But i think a simple close() method is needed to close() the stream like it's done in Monolog\Handler\StreamHandler and documented in Monolog\Handler\HandlerInterface.

Fneufneu avatar Dec 09 '24 08:12 Fneufneu

hey @Fneufneu, could my issue be related to the one you stated? #7 ?

Perf avatar Mar 10 '25 21:03 Perf