summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS19
-rw-r--r--configure.ac2
-rw-r--r--debian/changelog6
m---------lib0
-rw-r--r--python/conf/skylog.ini2
-rw-r--r--python/skytools/skylog.py48
-rw-r--r--source.cfg2
7 files changed, 75 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 1ff97bf0..2a204068 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,22 @@
+2012-04-09 - SkyTools 3.0.1 - "All The Snow You Can Eat"
+
+ = Features =
+
+ * skytools.config: new .getbytes() method to suppoer
+ human-readable sizes.
+
+ = Fixes =
+
+ * skytools.skylog: Wrap logger.handlers.SysLogHandler to work
+ around broken BOM addition when logging unicode() strings.
+
+ * skytools.skylog: Improve compatibility with direct
+ logger module usage.
+
+ * debian/skytools.ini: include in tgz
+
+ * pgqd(libusual): ignore EINTR on close()
+
2012-03-17 - SkyTools 3.0 - "Business Advantage"
= Major New Features =
diff --git a/configure.ac b/configure.ac
index 4c7d7153..c5f6da66 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(skytools, 3.0)
+AC_INIT(skytools, 3.0.1)
AC_CONFIG_SRCDIR(python/londiste.py)
AC_CONFIG_HEADER(lib/usual/config.h)
AC_PREREQ([2.59])
diff --git a/debian/changelog b/debian/changelog
index 21102007..83808cf5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+skytools3 (3.0.1) experimental; urgency=low
+
+ * v3.0.1
+
+ -- Marko Kreen <marko.kreen@skype.net> Mon, 09 Apr 2012 10:33:37 +0300
+
skytools3 (3.0) experimental; urgency=low
* v3.0
diff --git a/lib b/lib
-Subproject 398d5f653c5d0978b46b29bd7a4487089c7b21d
+Subproject af67361bf29d165214c3f0f40571137a9b525c6
diff --git a/python/conf/skylog.ini b/python/conf/skylog.ini
index 5e3531b4..af885377 100644
--- a/python/conf/skylog.ini
+++ b/python/conf/skylog.ini
@@ -78,7 +78,7 @@ args=('~/log/%(job_name)s.log', 100*1024*1024, 3)
formatter=long
[handler_syslog]
-class=handlers.SysLogHandler
+class=skylog.SysLogHandler
args=(('localhost', 514),)
formatter=syslog
diff --git a/python/skytools/skylog.py b/python/skytools/skylog.py
index 53c70a93..bf76940c 100644
--- a/python/skytools/skylog.py
+++ b/python/skytools/skylog.py
@@ -232,7 +232,51 @@ class LogDBHandler(logging.handlers.SocketHandler):
query = "select * from log.add(%s, %s, %s)"
logcur.execute(query, [type, service, msg])
-# send messages to syslog
+# fix unicode bug in SysLogHandler
+class SysLogHandler(logging.handlers.SysLogHandler):
+ """Fixes unicode bug in logging.handlers.SysLogHandler."""
+
+ # be compatible with both 2.6 and 2.7
+ socktype = socket.SOCK_DGRAM
+
+ def emit(self, record):
+ """
+ Emit a record.
+
+ The record is formatted, and then sent to the syslog server. If
+ exception information is present, it is NOT sent to the server.
+ """
+ msg = self.format(record) + '\000'
+ """
+ We need to convert record level to lowercase, maybe this will
+ change in the future.
+ """
+ prio = '<%d>' % self.encodePriority(self.facility,
+ self.mapPriority(record.levelname))
+ # Message is a string. Convert to bytes as required by RFC 5424
+ if type(msg) is unicode:
+ msg = msg.encode('utf-8')
+ ## this puts BOM in wrong place
+ #if codecs:
+ # msg = codecs.BOM_UTF8 + msg
+ msg = prio + msg
+ try:
+ if self.unixsocket:
+ try:
+ self.socket.send(msg)
+ except socket.error:
+ self._connect_unixsocket(self.address)
+ self.socket.send(msg)
+ elif self.socktype == socket.SOCK_DGRAM:
+ self.socket.sendto(msg, self.address)
+ else:
+ self.socket.sendall(msg)
+ except (KeyboardInterrupt, SystemExit):
+ raise
+ except:
+ self.handleError(record)
+
+
class SysLogHostnameHandler(logging.handlers.SysLogHandler):
"""Slightly modified standard SysLogHandler - sends also hostname and service type"""
@@ -243,6 +287,8 @@ class SysLogHostnameHandler(logging.handlers.SysLogHandler):
_hostname,
_service_name,
msg)
+ if type(msg) is unicode:
+ msg = msg.encode('utf-8')
try:
if self.unixsocket:
try:
diff --git a/source.cfg b/source.cfg
index 2d8278a6..66cdcce3 100644
--- a/source.cfg
+++ b/source.cfg
@@ -16,7 +16,7 @@ recursive-include python/conf *.ini
recursive-include misc *.sh *.rc *.py *.css Cindent
recursive-include scripts *.py *.templ *.ini
recursive-include debian changelog control control.in docs rules compat pgversions README.*
-recursive-include debian *.dirs *.docs *.install *.init.d *.manpages *.postinst *.prerm
+recursive-include debian *.dirs *.docs *.install *.init.d *.manpages *.postinst *.prerm *.ini
recursive-include doc Makefile *.py *.txt *.[1-9]
prune debian/postgresql-*-pgq3
prune debian/skytools3