line = re.sub(r'\s*{\s*$', '', line)
do_start_logfile_definition = True
if not in_logfile_list:
- self._start_new_log()
+ self._start_new_log(configfile, linenr)
in_logfile_list = True
parts = split_parts(line)
return name
#------------------------------------------------------------
- def _start_new_log(self):
+ def _start_new_log(self, config_file, rownum):
'''
Starting a new log definition in self.new_log and filling it
with the current default values.
+
+ @param config_file: the configuration file with the start
+ of the logfile definition
+ @type config_file: str
+ @param rownum: the row number of the configuration file
+ with the start of the logfile definition
+ @type rownum: int
'''
_ = self.t.lgettext
self.new_log['compress_cmd'] = self.default['compress_cmd']
self.new_log['compress_ext'] = self.default['compress_ext']
self.new_log['compress_opts'] = self.default['compress_opts']
+ self.new_log['configfile'] = config_file
+ self.new_log['configrow'] = rownum
self.new_log['copy'] = self.default['copy']
self.new_log['copytruncate'] = self.default['copytruncate']
self.new_log['create'] = {
% {'file': logfile, 'pattern': pattern }
self.logger.debug(msg)
if logfile in self.defined_logfiles:
- msg = _("Logfile '%s' is even defined and so not taken a second time.") \
- % (logfile)
+ f = self.defined_logfiles[logfile]
+ msg = ( _("Logfile '%(logfile)s' is even defined (file '%(cfgfile)s', " +
+ "row %(rownum)d) and so not taken a second time.")
+ % {'logfile': logfile,
+ 'cfgfile': f['file'],
+ 'rownum': f['rownum']}
+ )
self.logger.warning(msg)
continue
if self.verbose > 1:
msg = _("Logfile '%s' will taken.") \
% (logfile)
- self.defined_logfiles[logfile] = True
+ self.defined_logfiles[logfile] = {
+ 'file': self.new_log['configfile'],
+ 'rownum': self.new_log['configrow'],
+ }
self.new_log['files'].append(logfile)
return len(self.new_log['files'])
msgid "Found logfile '%(file)s for pattern '%(pattern)s'."
msgstr "Logdatei »%(file)s« zum Suchmuster »%(pattern)s« gefunden."
-#: LogRotateConfig.py:1874
+#: LogRotateConfig.py:1884
#, python-format
-msgid "Logfile '%s' is even defined and so not taken a second time."
-msgstr "Die Logdatei »%s« wurde bereits definiert und damit nicht noch einmal berücksichtigt."
+msgid ""
+"Logfile '%(logfile)s' is even defined (file '%(cfgfile)s', "
+"row %(rownum)d) and so not taken a second time."
+msgstr ""
+"Die Logdatei »%(logfile)s« wurde bereits definiert (Datei "
+"»%(cfgfile)s«, Zeile %(rownum)d) und wird damit nicht noch einmal berücksichtigt."
#: LogRotateConfig.py:1879
#, python-format
msgid "Found logfile '%(file)s for pattern '%(pattern)s'."
msgstr ""
-#: LogRotateConfig.py:1874
+#: LogRotateConfig.py:1884
#, python-format
-msgid "Logfile '%s' is even defined and so not taken a second time."
+msgid ""
+"Logfile '%(logfile)s' is even defined (file '%(cfgfile)s', "
+"row %(rownum)d) and so not taken a second time."
msgstr ""
#: LogRotateConfig.py:1879
# $URL$
#
-all: pylogrotate.de.mo LogRotateGetopts.de.mo LogRotateConfig.de.mo LogRotateStatusFile.de.mo
+.SUFFIXES: .mo .po
-pylogrotate.de.mo: pylogrotate.de.po
- @echo
- @echo "Compiling $@ ..."
- msgfmt -o pylogrotate.de.mo --check -v pylogrotate.de.po
- @if [ ! -d de_DE/LC_MESSAGES ] ; then mkdir -vp de_DE/LC_MESSAGES; fi
- @cp -pv pylogrotate.de.mo de_DE/LC_MESSAGES/pylogrotate.mo
+MODULE = pylogrotate LogRotateGetopts LogRotateConfig LogRotateStatusFile
-LogRotateGetopts.de.mo: LogRotateGetopts.de.po
- @echo
- @echo "Compiling $@ ..."
- msgfmt -o LogRotateGetopts.de.mo --check -v LogRotateGetopts.de.po
- @if [ ! -d de_DE/LC_MESSAGES ] ; then mkdir -vp de_DE/LC_MESSAGES; fi
- @cp -pv LogRotateGetopts.de.mo de_DE/LC_MESSAGES/LogRotateGetopts.mo
+all: $(MODULE:=.de.mo)
-LogRotateConfig.de.mo: LogRotateConfig.de.po
+.po.mo:
@echo
- @echo "Compiling $@ ..."
- msgfmt -o LogRotateConfig.de.mo --check -v LogRotateConfig.de.po
+ @echo "Compiling $*.mo from $*.po ..."
+ msgfmt -o $*.mo --check -v $*.po
@if [ ! -d de_DE/LC_MESSAGES ] ; then mkdir -vp de_DE/LC_MESSAGES; fi
- @cp -pv LogRotateConfig.de.mo de_DE/LC_MESSAGES/LogRotateConfig.mo
+ @TARGET=de_DE/LC_MESSAGES/`echo $* | sed s'/\.de$$//'`.mo; \
+ cp -pv $*.mo $$TARGET
-LogRotateStatusFile.de.mo: LogRotateStatusFile.de.po
- @echo
- @echo "Compiling $@ ..."
- msgfmt -o LogRotateStatusFile.de.mo --check -v LogRotateStatusFile.de.po
- @if [ ! -d de_DE/LC_MESSAGES ] ; then mkdir -vp de_DE/LC_MESSAGES; fi
- @cp -pv LogRotateStatusFile.de.mo de_DE/LC_MESSAGES/LogRotateStatusFile.mo
pidfile /home/frank/Development/Python/PyLogrotate/logrotate.pid
+/var/log/apache2/access_log {
+ missingok
+ notifempty
+ sharedscripts
+ rotate 10
+ dateext
+ daily
+ size 5M
+ maxage 0.5y
+ mail test@uhu-banane.de
+ olddir /var/log/apache2/%Y-%m 0755 apache users
+ postrotate
+ /etc/init.d/apache2 reload > /dev/null 2>&1 || true
+ endscript
+}
+
/var/log/apache2/access_log
/var/log/apache2/*.log
{