1Appender::Socket::UNIX(U3s)er Contributed Perl DocumentatAipopnender::Socket::UNIX(3)
2
3
4

NAME

6       Log::Log4perl::Appender::Socket::UNIX- Log to a Unix Domain Socket
7

SYNOPSIS

9               use Log::Log4perl::Appender::Socket::UNIX;
10
11               my $appender = Log::Log4perl::Appender::Socket::UNIX->new(
12                       Socket => '/var/tmp/myprogram.sock'
13               );
14
15               $appender->log(message => "Log me\n");
16

DESCRIPTION

18       This is a simple appender for writing to a unix domain socket. It
19       relies on Socket and only logs to an existing socket - ie. very useful
20       to always log debug streams to the socket.
21
22       The appender tries to stream to a socket. The socket in questions is
23       beeing created by the client who wants to listen, once created the
24       messages are coming thru.
25

EXAMPLE

27       Write a client quickly using the Socket module:
28
29               use Socket;
30
31               my $s = "/var/tmp/myprogram.sock";
32
33               unlink($s) or die("Failed to unlin socket - check permissions.\n");
34
35               # be sure to set a correct umask so that the appender is allowed to stream to:
36               # umask(000);
37
38               socket(my $socket, PF_UNIX, SOCK_DGRAM, 0);
39               bind($socket, sockaddr_un($s));
40
41               while (1) {
42                       while ($line = <$socket>) {
43                               print $line;
44                       }
45               }
46
48       Copyright 2012 by Jean Stebens <debian.helba@recursor.net>.
49
50       This library is free software; you can redistribute it and/or modify it
51       under the same terms as Perl itself.
52
53
54
55perl v5.34.0                      2021-07-22         Appender::Socket::UNIX(3)
Impressum