Currentl, any write error in Mojo::Log append() method raises an exception:
$handle->print(encode('UTF-8', $msg)) or croak "Can't write to log: $!";
As a consequence, a disk-full error, which is an unfortunate but possible issue on any kind of web-facing application, makes logging fatal to the application, unless each call to log() is wrapped into an eval, try/catch, or any other exception-handling block. While perfectly possible, this seems a bit overkill. An attribute making write error non-fatal, while retaining current default behaviour, would make the issue easier to handle:
# croak "Can't write to log: $!" when disk is full
Mojo::Log->new(file => 'file.log')->info("message");
# warn "Can't write to log: $!" when disk is full
Mojo::Log->new(file => 'file.log', resilient => 1)->info("message");
Currentl, any write error in Mojo::Log append() method raises an exception:
As a consequence, a disk-full error, which is an unfortunate but possible issue on any kind of web-facing application, makes logging fatal to the application, unless each call to log() is wrapped into an eval, try/catch, or any other exception-handling block. While perfectly possible, this seems a bit overkill. An attribute making write error non-fatal, while retaining current default behaviour, would make the issue easier to handle: