2010-01-21 12:46:20 +00:00
|
|
|
#
|
2011-11-17 14:05:53 +00:00
|
|
|
# spec file for package perl-Log-Dispatch-FileRotate
|
2010-01-21 12:46:20 +00:00
|
|
|
#
|
2017-02-13 18:37:57 +00:00
|
|
|
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
2010-01-21 12:46:20 +00:00
|
|
|
#
|
|
|
|
# All modifications and additions to the file contributed by third parties
|
|
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
|
|
# upon. The license for this file, and modifications and additions to the
|
|
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
|
|
# license for the pristine package is not an Open Source License, in which
|
|
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
|
|
# published by the Open Source Initiative.
|
|
|
|
|
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
Name: perl-Log-Dispatch-FileRotate
|
2017-02-15 18:51:56 +00:00
|
|
|
Version: 1.24
|
2016-12-05 06:21:40 +00:00
|
|
|
Release: 0
|
2011-11-17 14:05:53 +00:00
|
|
|
%define cpan_name Log-Dispatch-FileRotate
|
2016-12-05 06:21:40 +00:00
|
|
|
Summary: Log to Files that Archive/Rotate Themselves
|
|
|
|
License: Artistic-1.0 or GPL-1.0+
|
2010-01-21 12:46:20 +00:00
|
|
|
Group: Development/Libraries/Perl
|
2016-12-05 06:21:40 +00:00
|
|
|
Url: http://search.cpan.org/dist/Log-Dispatch-FileRotate/
|
2017-02-13 18:37:57 +00:00
|
|
|
Source0: https://cpan.metacpan.org/authors/id/M/MS/MSCHOUT/%{cpan_name}-%{version}.tar.gz
|
2016-12-05 06:21:40 +00:00
|
|
|
Source1: cpanspec.yml
|
|
|
|
BuildArch: noarch
|
2010-01-21 12:46:20 +00:00
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
|
|
BuildRequires: perl
|
|
|
|
BuildRequires: perl-macros
|
|
|
|
BuildRequires: perl(Date::Manip)
|
2016-12-05 06:21:40 +00:00
|
|
|
BuildRequires: perl(Log::Dispatch::File)
|
2010-01-21 12:46:20 +00:00
|
|
|
BuildRequires: perl(Log::Dispatch::Output)
|
|
|
|
BuildRequires: perl(Params::Validate)
|
2016-12-05 06:21:40 +00:00
|
|
|
BuildRequires: perl(Path::Tiny) >= 0.018
|
|
|
|
BuildRequires: perl(Test::More) >= 0.88
|
2017-02-13 18:37:57 +00:00
|
|
|
BuildRequires: perl(Test::Warn)
|
2016-12-05 06:21:40 +00:00
|
|
|
BuildRequires: perl(version)
|
2010-01-21 12:46:20 +00:00
|
|
|
Requires: perl(Date::Manip)
|
2016-12-05 06:21:40 +00:00
|
|
|
Requires: perl(Log::Dispatch::File)
|
|
|
|
Requires: perl(Log::Dispatch::Output)
|
2010-01-21 12:46:20 +00:00
|
|
|
Requires: perl(Params::Validate)
|
2016-12-05 06:21:40 +00:00
|
|
|
Requires: perl(version)
|
|
|
|
%{perl_requires}
|
2010-01-21 12:46:20 +00:00
|
|
|
|
|
|
|
%description
|
|
|
|
This module provides a simple object for logging to files under the
|
|
|
|
Log::Dispatch::* system, and automatically rotating them according to
|
2016-12-05 06:21:40 +00:00
|
|
|
different constraints. This is basically a Log::Dispatch::File wrapper with
|
|
|
|
additions. To that end the arguments
|
2010-01-21 12:46:20 +00:00
|
|
|
|
2016-12-05 06:21:40 +00:00
|
|
|
name, min_level, filename and mode
|
2010-01-21 12:46:20 +00:00
|
|
|
|
|
|
|
behave the same as Log::Dispatch::File. So see its man page (perldoc
|
|
|
|
Log::Dispatch::File)
|
|
|
|
|
2016-12-05 06:21:40 +00:00
|
|
|
The arguments size and max specify the maximum size and maximum number of
|
|
|
|
log files created. The size defaults to 10M and the max number of files
|
|
|
|
defaults to 1. If DatePattern is not defined then we default to working in
|
|
|
|
size mode. That is, use size values for deciding when to rotate.
|
|
|
|
|
|
|
|
Once DatePattern is defined FileRotate will move into time mode. Once this
|
|
|
|
happens file rotation ignores size constraints and uses the defined date
|
|
|
|
pattern constraints.
|
2010-01-21 12:46:20 +00:00
|
|
|
|
2016-12-05 06:21:40 +00:00
|
|
|
If you setup a config file using Log::Log4perl::init_and_watch() or the
|
|
|
|
like, you can switch between modes just by commenting out the DatePattern
|
|
|
|
line.
|
2010-01-21 12:46:20 +00:00
|
|
|
|
2016-12-05 06:21:40 +00:00
|
|
|
When using DatePattern make sure TZ is defined correctly and that the TZ
|
|
|
|
you use is understood by Date::Manip. We use Date::Manip to generate our
|
|
|
|
recurrences. Bad TZ equals bad recurrences equals surprises! Read the
|
|
|
|
Date::Manip man page for more details on TZ.
|
2010-01-21 12:46:20 +00:00
|
|
|
|
2016-12-05 06:21:40 +00:00
|
|
|
DatePattern will default to a daily rotate if your entered pattern is
|
|
|
|
incorrect. You will also get a warning message.
|
|
|
|
|
|
|
|
If you have multiple writers that were started at different times you will
|
|
|
|
find each writer will try to rotate the log file at a recurrence calculated
|
|
|
|
from its start time. To sync all the writers just use a config file and
|
|
|
|
update it after starting your last writer. This will cause
|
|
|
|
Log::Dispatch::FileRotate->new() to be called by each of the writers close
|
|
|
|
to the same time, and if your recurrences aren't too close together all
|
|
|
|
should sync up just nicely.
|
|
|
|
|
2017-02-13 18:37:57 +00:00
|
|
|
I initially assumed a long running process but it seems people are using
|
2016-12-05 06:21:40 +00:00
|
|
|
this module as part of short running CGI programs. So, now we look at the
|
|
|
|
last modified time stamp of the log file and compare it to a previous
|
|
|
|
occurance of a DatePattern, on startup only. If the file stat shows the
|
|
|
|
mtime to be earlier than the previous recurrance then I rotate the log
|
|
|
|
file.
|
|
|
|
|
|
|
|
We handle multiple writers using flock().
|
2010-01-21 12:46:20 +00:00
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -q -n %{cpan_name}-%{version}
|
2016-12-05 06:21:40 +00:00
|
|
|
find . -type f ! -name \*.pl -print0 | xargs -0 chmod 644
|
2010-01-21 12:46:20 +00:00
|
|
|
|
|
|
|
%build
|
2016-12-05 06:21:40 +00:00
|
|
|
%{__perl} Makefile.PL INSTALLDIRS=vendor
|
|
|
|
%{__make} %{?_smp_mflags}
|
2010-01-21 12:46:20 +00:00
|
|
|
|
|
|
|
%check
|
|
|
|
%{__make} test
|
|
|
|
|
|
|
|
%install
|
|
|
|
%perl_make_install
|
|
|
|
%perl_process_packlist
|
|
|
|
%perl_gen_filelist
|
|
|
|
|
|
|
|
%files -f %{name}.files
|
2016-12-05 06:21:40 +00:00
|
|
|
%defattr(-,root,root,755)
|
2017-02-13 18:37:57 +00:00
|
|
|
%doc Changes README
|
|
|
|
%license LICENSE
|
2010-01-21 12:46:20 +00:00
|
|
|
|
|
|
|
%changelog
|