[asterisk-commits] kpfleming: branch 1.4 r193193 - in /branches/1.4: configs/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri May 8 09:03:31 CDT 2009


Author: kpfleming
Date: Fri May  8 09:03:28 2009
New Revision: 193193

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=193193
Log:
Make absolute paths for logger channels work properly

(Note: This is not a new feature, it was previously undocumented and broken.)

The Asterisk logger has a feature to support absolute pathnames for logger channels, but the code implementing the feature was broken. This has been fixed, and the absolute path feature is now documented in the sample logger.conf.


Modified:
    branches/1.4/configs/logger.conf.sample
    branches/1.4/main/logger.c

Modified: branches/1.4/configs/logger.conf.sample
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/configs/logger.conf.sample?view=diff&rev=193193&r1=193192&r2=193193
==============================================================================
--- branches/1.4/configs/logger.conf.sample (original)
+++ branches/1.4/configs/logger.conf.sample Fri May  8 09:03:28 2009
@@ -46,6 +46,10 @@
 ;
 ; Special filename "console" represents the system console
 ;
+; Filenams can either be relative to the standard Asterisk log directory
+; (see 'astlogdir' in asterisk.conf), or absolute paths that begin with
+; '/'.
+;
 ; We highly recommend that you DO NOT turn on debug mode if you are simply
 ; running a production system.  Debug mode turns on a LOT of extra messages,
 ; most of which you are unlikely to understand without an understanding of

Modified: branches/1.4/main/logger.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/main/logger.c?view=diff&rev=193193&r1=193192&r2=193193
==============================================================================
--- branches/1.4/main/logger.c (original)
+++ branches/1.4/main/logger.c Fri May  8 09:03:28 2009
@@ -257,18 +257,12 @@
 		snprintf(chan->filename, sizeof(chan->filename), "%s", channel);
 		openlog("asterisk", LOG_PID, chan->facility);
 	} else {
-		if (channel[0] == '/') {
-			if(!ast_strlen_zero(hostname)) { 
-				snprintf(chan->filename, sizeof(chan->filename) - 1,"%s.%s", channel, hostname);
-			} else {
-				ast_copy_string(chan->filename, channel, sizeof(chan->filename));
-			}
-		}		  
-		
-		if(!ast_strlen_zero(hostname)) {
-			snprintf(chan->filename, sizeof(chan->filename), "%s/%s.%s",(char *)ast_config_AST_LOG_DIR, channel, hostname);
+		if (!ast_strlen_zero(hostname)) {
+			snprintf(chan->filename, sizeof(chan->filename), "%s/%s.%s",
+				 channel[0] != '/' ? ast_config_AST_LOG_DIR : "", channel, hostname);
 		} else {
-			snprintf(chan->filename, sizeof(chan->filename), "%s/%s", (char *)ast_config_AST_LOG_DIR, channel);
+			snprintf(chan->filename, sizeof(chan->filename), "%s/%s",
+				 channel[0] != '/' ? ast_config_AST_LOG_DIR : "", channel);
 		}
 		chan->fileptr = fopen(chan->filename, "a");
 		if (!chan->fileptr) {




More information about the asterisk-commits mailing list