Index: main/logger.c =================================================================== --- main/logger.c (revision 258345) +++ main/logger.c (working copy) @@ -74,6 +74,7 @@ static int filesize_reload_needed; static unsigned int global_logmask = 0xFFFF; +static int strip_color = 1; static enum rotatestrategy { SEQUENTIAL = 1 << 0, /* Original method - create a new file, in order */ @@ -342,6 +343,8 @@ ast_copy_string(dateformat, "%b %e %T", sizeof(dateformat)); if ((s = ast_variable_retrieve(cfg, "general", "queue_log"))) logfiles.queue_log = ast_true(s); + if ((s = ast_variable_retrieve(cfg, "general", "strip_color"))) + strip_color = ast_true(s); if ((s = ast_variable_retrieve(cfg, "general", "queue_log_name"))) ast_copy_string(queue_log_name, s, sizeof(queue_log_name)); if ((s = ast_variable_retrieve(cfg, "general", "exec_after_rotate"))) @@ -794,6 +797,7 @@ { struct logchannel *chan = NULL; char buf[BUFSIZ]; + char *message; AST_RWLIST_RDLOCK(&logchannels); @@ -837,8 +841,10 @@ } /* Print out to the file */ + message = (strip_color) ? term_strip(buf, logmsg->message, BUFSIZ) : logmsg->message; res = fprintf(chan->fileptr, "[%s] %s[%ld] %s: %s", - logmsg->date, logmsg->level_name, logmsg->process_id, logmsg->file, term_strip(buf, logmsg->message, BUFSIZ)); + logmsg->date, logmsg->level_name, logmsg->process_id, logmsg->file, message); + ast_free(message); if (res <= 0 && !ast_strlen_zero(logmsg->message)) { fprintf(stderr, "**** Asterisk Logging Error: ***********\n"); if (errno == ENOMEM || errno == ENOSPC) Index: configs/logger.conf.sample =================================================================== --- configs/logger.conf.sample (revision 258345) +++ configs/logger.conf.sample (working copy) @@ -22,6 +22,10 @@ ; This appends the hostname to the name of the log files. ;appendhostname = yes ; +; Remove coloring escape sequences from log files. +; (defaults to yes) +;strip_color=no +; ; This determines whether or not we log queue events to a file ; (defaults to yes). ;queue_log = no