1Appender::Limit(3)    User Contributed Perl Documentation   Appender::Limit(3)
2
3
4

NAME

6           Log::Log4perl::Appender::Limit - Limit message delivery via block period
7

SYNOPSIS

9           use Log::Log4perl qw(:easy);
10
11           my $conf = qq(
12             log4perl.category = WARN, Limiter
13
14                 # Email appender
15             log4perl.appender.Mailer          = Log::Dispatch::Email::MailSend
16             log4perl.appender.Mailer.to       = drone\@pageme.com
17             log4perl.appender.Mailer.subject  = Something's broken!
18             log4perl.appender.Mailer.buffered = 0
19             log4perl.appender.Mailer.layout   = PatternLayout
20             log4perl.appender.Mailer.layout.ConversionPattern=%d %m %n
21
22                 # Limiting appender, using the email appender above
23             log4perl.appender.Limiter              = Log::Log4perl::Appender::Limit
24             log4perl.appender.Limiter.appender     = Mailer
25             log4perl.appender.Limiter.block_period = 3600
26           );
27
28           Log::Log4perl->init(\$conf);
29           WARN("This message will be sent immediately");
30           WARN("This message will be delayed by one hour.");
31           sleep(3601);
32           WARN("This message plus the last one will be sent now");
33

DESCRIPTION

35       "appender"
36           Specifies the name of the appender used by the limiter. The appen‐
37           der specified must be defined somewhere in the configuration file,
38           not necessarily before the definition of "Log::Log4perl::Appen‐
39           der::Limit".
40
41       "block_period"
42           Period in seconds between delivery of messages. If messages arrive
43           in between, they will be either saved (if "accumulate" is set to a
44           true value) or discarded (if "accumulate" isn't set).
45
46       "persistent"
47           File name in which "Log::Log4perl::Appender::Limit" persistently
48           stores delivery times. If omitted, the appender will have no recol‐
49           lection of what happened when the program restarts.
50
51       "max_until_flushed"
52           Maximum number of accumulated messages. If exceeded, the appender
53           flushes all messages, regardless if the interval set in
54           "block_period" has passed or not. Don't mix with "max_until_dis‐
55           carded".
56
57       "max_until_discarded"
58           Maximum number of accumulated messages. If exceeded, the appender
59           will simply discard additional messages, waiting for "block_period"
60           to expire to flush all accumulated messages. Don't mix with
61           "max_until_flushed".
62
63       If the appender attached to "Limit" uses "PatternLayout" with a time‐
64       stamp specifier, you will notice that the message timestamps are
65       reflecting the original log event, not the time of the message render‐
66       ing in the attached appender. Major trickery has applied to accomplish
67       this (Cough!).
68

DEVELOPMENT NOTES

70       "Log::Log4perl::Appender::Limit" is a composite appender.  Unlike other
71       appenders, it doesn't log any messages, it just passes them on to its
72       attached sub-appender.  For this reason, it doesn't need a layout (con‐
73       trary to regular appenders).  If it defines none, messages are passed
74       on unaltered.
75
76       Custom filters are also applied to the composite appender only.  They
77       are not applied to the sub-appender. Same applies to appender thresh‐
78       olds. This behaviour might change in the future.
79

LEGALESE

81       Copyright 2004 by Mike Schilli, all rights reserved.  This program is
82       free software, you can redistribute it and/or modify it under the same
83       terms as Perl itself.
84

AUTHOR

86       2004, Mike Schilli <m@perlmeister.com>
87
88
89
90perl v5.8.8                       2002-07-10                Appender::Limit(3)
Impressum