Changes for version 0.40 - 2026-10-11
- Enhancements
- New log_any and log_dispatch backends in the logger hash send messages on to Log::Any (a category name or a Log::Any logger) and Log::Dispatch, with their own level and format like the other backends. Log::Any gets structured fields as data. A message that comes back through Log::Any::Adapter::Abstraction isn't forwarded again, so a set-up pointing at itself doesn't loop.
- A Log::Any logger or Log::Dispatch object given as the logger is used the same way. Before, Log::Dispatch croaked on trace() (it has no trace method), and both joined the message's parts with spaces.
- Log files written by path are kept open between messages instead of being opened and closed for every line. A file renamed or deleted (e.g. by logrotate) is noticed on the next write. Except on Windows, a SIGHUP makes every logger reopen its files (see API Changes). In case no SIGHUP is sent, they are reopened every reopen_interval seconds, a new option: default 300, -1 for only on SIGHUP, and 0 to close the file after every message as before. The new reopen() method closes them.
- The journald backend keeps its socket open between messages instead of creating one for every message. A failed send closes it, and the next message opens a new one.
- New sendmail option async: the email is sent by a forked child, so the log call doesn't wait for the SMTP server. A failure is carped by the child, and the message is lost rather than held. On Windows the email is sent in the log call as before.
- API Changes
- The minimum Perl is now 5.26. Params::Validate::Strict, which Return::Set, Sub::Private and Config::Abstraction need, requires it, so the dependencies couldn't be installed on older perls anyway.
- Except on Windows, the first logger to open a log file installs a $SIG{HUP} handler, which calls any handler already set. So SIGHUP no longer ends the program while such a logger exists; the previous handler is put back when the last one is destroyed. Use reopen_interval => 0 for the old behaviour.
- Log files are now held open, and on Windows another program can't rename or delete an open file; call reopen() first, or use reopen_interval => 0.
- Each backend is now a Log::Abstraction::Backend::* object, built once by new() instead of worked out again for every message.
- new() croaks on a logger hash with none of the backend keys, and on a logger that is an unsupported kind of reference. Before, the first message croaked ("Don't know how to deal with the <level> message", "configuration error, no handler written for the <level> message").
- Bug Fixes
- The syslog hash given to new() is no longer changed: the first message renamed its 'server' key 'host'.
- Tests
- New t/producers.t, t/backends.t, t/file_handles.t and t/sendmail_async.t.
Documentation
Modules
Logging Abstraction Layer
base class of the Log::Abstraction backends
push messages onto an array
call a code reference with each message
print messages to a file handle
append messages to a file
send messages to the systemd journal
send messages on to Log::Any
send messages on to Log::Dispatch
call a logger object's method for each message
email messages
send messages to syslog
Log::Any adapter backed by Log::Abstraction