From: erickson Date: Sun, 20 Aug 2006 15:58:43 +0000 (+0000) Subject: truncate messages more to prevent syslog overflow errors X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=274fca6b269b37fe34dfee8b3b4a0b6bbec94071;p=opensrf%2Fbjwebb.git truncate messages more to prevent syslog overflow errors git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@762 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/perlmods/OpenSRF/Utils/Logger.pm b/src/perlmods/OpenSRF/Utils/Logger.pm index 7db43a0..69d79d2 100644 --- a/src/perlmods/OpenSRF/Utils/Logger.pm +++ b/src/perlmods/OpenSRF/Utils/Logger.pm @@ -208,7 +208,7 @@ sub _log_message { $msg = "[$n:"."$$".":::] $msg"; - $msg = substr($msg, 0, 2000); + $msg = substr($msg, 0, 1536); if( $level == ACTIVITY() ) { if( is_act_syslog() ) { syslog( $fac | $l, $msg ); } diff --git a/src/utils/log.c b/src/utils/log.c index 8f3c2fc..7e2959f 100644 --- a/src/utils/log.c +++ b/src/utils/log.c @@ -124,8 +124,16 @@ void _osrfLogDetail( int level, const char* filename, int line, char* msg ) { break; } - if(__osrfLogType == OSRF_LOG_TYPE_SYSLOG ) - syslog( fac | lvl, "[%s:%d:%s:%d] %s", l, getpid(), filename, line, msg ); + if(__osrfLogType == OSRF_LOG_TYPE_SYSLOG ) { + char buf[1536]; + /* give syslog some breathing room, and be cute about it */ + strncat(buf, msg, 1535); + buf[1532] = '.'; + buf[1533] = '.'; + buf[1534] = '.'; + buf[1535] = '\0'; + syslog( fac | lvl, "[%s:%d:%s:%d] %s", l, getpid(), filename, line, buf ); + } else if( __osrfLogType == OSRF_LOG_TYPE_FILE ) _osrfLogToFile("[%s:%d:%s:%d] %s", l, getpid(), filename, line, msg );