aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-08 14:09:05 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-08 14:09:05 +0000
commita6a11262d1a84e81eda3c0469b1e0eabbb1776d2 (patch)
tree8192c16c13d112c2164d4340f59e3825233663fa
parent34d1acbece86f43f427afe9bf02ad5b629c97133 (diff)
Merged revisions 193194 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r193194 | kpfleming | 2009-05-08 09:06:15 -0500 (Fri, 08 May 2009) | 13 lines Merged revisions 193193 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r193193 | kpfleming | 2009-05-08 09:03:28 -0500 (Fri, 08 May 2009) | 7 lines 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. ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@193195 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--configs/logger.conf.sample4
-rw-r--r--main/logger.c14
2 files changed, 8 insertions, 10 deletions
diff --git a/configs/logger.conf.sample b/configs/logger.conf.sample
index a441ebd8f..54e9d7907 100644
--- a/configs/logger.conf.sample
+++ b/configs/logger.conf.sample
@@ -73,6 +73,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
diff --git a/main/logger.c b/main/logger.c
index f16b12f23..aa81f83da 100644
--- a/main/logger.c
+++ b/main/logger.c
@@ -295,18 +295,12 @@ static struct logchannel *make_logchannel(const char *channel, const char *compo
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), "%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", ast_config_AST_LOG_DIR, channel, 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", 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) {