Appende...t::UNIX(3)
π NAME π
Log::Log4perl::Appender::Socket::UNIX β the appender that slides your log lines straight into a Unix Domain Socket β¨
(also known as Appende...t::UNIX(3), from the User Contributed Perl Documentation collection, bestie π«Ά)
πΈ SYNOPSIS πΈ
use Log::Log4perl::Appender::Socket::UNIX;
my $appender = Log::Log4perl::Appender::Socket::UNIX->new(
Socket => '/var/tmp/myprogram.sock'
);
$appender->log(message => "Log me\n");
okay so that's literally it, that's the whole vibe π
π¦ DESCRIPTION π¦
So like, this is a simple appender for writing to a unix domain socket. It's leaning on Socket for all the heavy lifting, and here's the tea: it only logs to a socket that already exists. Which is genuinely so useful when you want to always stream your debug output into a socket, no cap π«Ά
The appender tries to stream to a socket. And the socket in question? That's being created by the client who wants to listen β so once that client has made it, the messages start coming thru. periodt. β¨
π EXAMPLE π
wanna write a client real quick using the Socket module? bet. here's how:
use Socket;
my $s = "/var/tmp/myprogram.sock";
unlink($s) or die("Failed to unlin socket - check permissions.\n");
# be sure to set a correct umask so that the appender is allowed to stream to:
# umask(000);
socket(my $socket, PF_UNIX, SOCK_DGRAM, 0);
bind($socket, sockaddr_un($s));
while (1) {
while ($line = <$socket>) {
print $line;
}
}
π note the little comment in there about setting a correct umask so the appender is allowed to stream to it β don't skip that, it's giving main character energy for a reason π
π COPYRIGHT AND LICENSE π
Copyright 2012 by Jean Stebens <debian.helba@recursor.net>. π«Ά
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. slay. π
and that's the whole page bestie!! this was perl v5.42.0, dated 2025-07-25, from Appende...t::UNIX(3) β mwah, go log something iconic π
πβ¨
π¦ where this page comes from
- fedora 43: perl-Log-Log4perl-Appender-Socket-UNIX 1.04-33.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms