]> Frank Brehm's Git Trees - my-stuff/py-logrotate.git/commitdiff
Ausgabe bei doppelten Dateiangaben verbessert, Makefile für Lokalisierung verbessert
authorFrank Brehm <frank@brehm-online.com>
Mon, 27 Jun 2011 10:18:30 +0000 (10:18 +0000)
committerFrank Brehm <frank@brehm-online.com>
Mon, 27 Jun 2011 10:18:30 +0000 (10:18 +0000)
git-svn-id: http://svn.brehm-online.com/svn/my-stuff/python/PyLogrotate/trunk@260 ec8d2aa5-1599-4edb-8739-2b3a1bc399aa

LogRotateConfig.py
po/LogRotateConfig.de.po
po/LogRotateConfig.pot
po/Makefile
test/apache2

index b73ee39953d9353bd667eb3524743993466e7b7c..b180b6cebe335df6ab193f347e0c5c7bd36da083 100755 (executable)
@@ -769,7 +769,7 @@ class LogrotateConfigurationReader(object):
                     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)
@@ -1779,10 +1779,17 @@ class LogrotateConfigurationReader(object):
         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
@@ -1799,6 +1806,8 @@ class LogrotateConfigurationReader(object):
         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']        = {
@@ -1871,14 +1880,22 @@ class LogrotateConfigurationReader(object):
                            % {'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'])
index 1d14bd455fdb2a1fd660bb562fb00cc08787d860..bb247e68acb053f793851b48b86ebf2b902e1e14 100644 (file)
@@ -686,10 +686,14 @@ msgstr "Keine Logdateien zum Suchmuster »%s« gefunden."
 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
index 950279ef8e1105f8f21e54da4da277c7ecab374c..debf1bfde0c0cfbc1803ba911a602a66468115c2 100644 (file)
@@ -576,9 +576,11 @@ msgstr ""
 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
index 45bbb9dcc7ab575d30f339fd50a00388d817a439..fe71c0b18deaa5de242f138164962029cd9e021e 100644 (file)
@@ -5,33 +5,18 @@
 # $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
 
index e90753e104b272b289a7b4a94652fcb4c5140a05..680ac24776118623ad947fd35b082f90b7cbf01d 100644 (file)
@@ -4,6 +4,22 @@
 
 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
 {