Log::A...Rotate(3pm)
π NAME π
Log::Agent::File::Rotate β it's giving rotating logfile set, bestie πΈ
β¨ SYNOPSIS β¨
#
# This class is not user-visible.
#
# It is documented only for programmers wishing to inherit
# from it to further extend its behaviour.
#
require Log::Agent::Driver::File;
require Log::Agent::Rotate;
require Log::Agent::File::Rotate;
my $config = Log::Agent::Rotate->make(...);
my $driver = Log::Agent::Driver::File->make(...);
my $fh = Log::Agent::File::Rotate->make("file", $config, $driver);
π¦ DESCRIPTION π¦
Okay so picture this: this class represents a rotating logfile and it's the one drivers call on when they wanna rotate their logfiles on a schedule. From the outside? It's lowkey chill β it exports a single print routine, exactly like Log::Agent::File::Native does. Same energy, no cap. π
But internally?? That's where the main character work happens. It takes the parameters you hand it in a Log::Agent::Rotate object and uses them to transparently close the current logfile and cycle the older logs. Iconic behaviour, honestly.
And before it rotates the current logfile, it emits this string:
*** LOGFILE ROTATED ON <local date>
so the people out there monitoring the file with tail -f actually know what's happening and aren't just sitting there like π wondering why the messages suddenly stopped. Not on our watch. We tell them. Communication queen. π
Its exported interface is:
π make file, config
This is the creation routine, the origin story, the birth of the whole thing. The config object is an instance of Log::Agent::Rotate.
π print args
Prints args to the file. But it's not just printing and dipping β oh no. After it's printed the data, it monitors the file against the thresholds defined in the configuration, and then possibly rotates the logfiles according to the parameters held in that same configuration object. She checks herself before she wrecks herself.
Now, when the is_alone flag is not set in the configuration, the logfile gets checked every single time a print is issued, just to see if its inode changed. Why, you ask? Because when several instances of the same program using rotating logfiles are running at once, any one of them might decide to cycle the logs at some point in time β and that means our opened handle could be pointing at a file that's already been renamed or unlinked. π Sneaky. So yeah, we check. Every time.
π AUTHORS π
Originally written by Raphael Manfredi <Raphael_Manfredi@pobox.com>, and currently maintained by Mark Rogaski <mrogaski@pobox.com>. Legends, both of them, fr fr. π«Ά
π SEE ALSO π
Log::Agent::Rotate(3), Log::Agent::Driver::File(3).
perl v5.32.1 β 2021-09-27 β that's the version and date on this page, bestie, and that's the whole vibe check. You understood the assignment. Slay. β¨ππ
π¦ where this page comes from
- debian bookworm: liblog-agent-rotate-perl 1.201-1 Β· Artistic-1.0-Perl
- debian trixie: liblog-agent-rotate-perl 1.201-1 Β· Artistic-1.0-Perl
- ubuntu jammy: liblog-agent-rotate-perl 1.201-1 Β· Artistic-1.0-Perl
- ubuntu noble: liblog-agent-rotate-perl 1.201-1 Β· Artistic-1.0-Perl
- ubuntu resolute: liblog-agent-rotate-perl 1.201-1 Β· Artistic-1.0-Perl
- ubuntu stonking: liblog-agent-rotate-perl 1.201-1 Β· Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms