Skip to content

Disk full error makes logging fatal to the application #2331

Description

@guillomovitch

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");

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions