Review Board 1.7.16


log Asterisk Version number, Build etc into log file

Review Request #1409 - Created Sept. 2, 2011 and submitted

Alec Davis
trunk
Reviewers
asterisk-dev
Asterisk
When the question is asked what was the last version that worked? You'd of thought looking through the logs it would be reported.
asterix:/var/log/asterisk# head messages
Asterisk SVN-trunk-r333838M built by root @ asterix on a i686 running Linux on 2011-05-27 11:52:02 UTC
[2011-09-05 21:13:25.672533] NOTICE[27089] loader.c: 1 modules will be loaded.
[2011-09-05 21:13:25.693952] WARNING[27089] http.c: Got 1 addresses

Diff revision 5 (Latest)

1 2 3 4 5
1 2 3 4 5

  1. trunk/main/logger.c: Loading...
trunk/main/logger.c
Revision 333893 New Change
[20] 45 lines
[+20] [+] ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
46
#include "asterisk/threadstorage.h"
46
#include "asterisk/threadstorage.h"
47
#include "asterisk/strings.h"
47
#include "asterisk/strings.h"
48
#include "asterisk/pbx.h"
48
#include "asterisk/pbx.h"
49
#include "asterisk/app.h"
49
#include "asterisk/app.h"
50
#include "asterisk/syslog.h"
50
#include "asterisk/syslog.h"

    
   
51
#include "asterisk/buildinfo.h"

    
   
52
#include "asterisk/ast_version.h"
51

    
   
53

   
52
#include <signal.h>
54
#include <signal.h>
53
#include <time.h>
55
#include <time.h>
54
#include <sys/stat.h>
56
#include <sys/stat.h>
55
#include <fcntl.h>
57
#include <fcntl.h>
[+20] [20] 177 lines
[+20] [+] static unsigned int make_components(const char *s, int lineno)
233

    
   
235

   
234
static struct logchannel *make_logchannel(const char *channel, const char *components, int lineno)
236
static struct logchannel *make_logchannel(const char *channel, const char *components, int lineno)
235
{
237
{
236
	struct logchannel *chan;
238
	struct logchannel *chan;
237
	char *facility;
239
	char *facility;

    
   
240
	struct ast_tm tm;

    
   
241
	struct timeval now = ast_tvnow();

    
   
242
	char datestring[256];
238

    
   
243

   
239
	if (ast_strlen_zero(channel) || !(chan = ast_calloc(1, sizeof(*chan) + strlen(components) + 1)))
244
	if (ast_strlen_zero(channel) || !(chan = ast_calloc(1, sizeof(*chan) + strlen(components) + 1)))
240
		return NULL;
245
		return NULL;
241

    
   
246

   
242
	strcpy(chan->components, components);
247
	strcpy(chan->components, components);
[+20] [20] 38 lines
[+20] static struct logchannel *make_logchannel(const char *channel, const char *components, int lineno)
281
			ast_console_puts_mutable("': ", __LOG_ERROR);
286
			ast_console_puts_mutable("': ", __LOG_ERROR);
282
			ast_console_puts_mutable(strerror(errno), __LOG_ERROR);
287
			ast_console_puts_mutable(strerror(errno), __LOG_ERROR);
283
			ast_console_puts_mutable("'\n", __LOG_ERROR);
288
			ast_console_puts_mutable("'\n", __LOG_ERROR);
284
			ast_free(chan);
289
			ast_free(chan);
285
			return NULL;
290
			return NULL;

    
   
291
		} else {

    
   
292
			/* Create our date/time */

    
   
293
			ast_localtime(&now, &tm, NULL);

    
   
294
			ast_strftime(datestring, sizeof(datestring), dateformat, &tm);

    
   
295

   

    
   
296
			fprintf(chan->fileptr, "[%s] Asterisk %s built by %s @ %s on a %s running %s on %s\n",

    
   
297
				datestring, ast_get_version(), ast_build_user, ast_build_hostname,

    
   
298
				ast_build_machine, ast_build_os, ast_build_date);

    
   
299
			fflush(chan->fileptr);
286
		}
300
		}
287
		chan->type = LOGTYPE_FILE;
301
		chan->type = LOGTYPE_FILE;
288
	}
302
	}
289
	chan->logmask = make_components(chan->components, lineno);
303
	chan->logmask = make_components(chan->components, lineno);
290

    
   
304

   
[+20] [20] 1376 lines
  1. trunk/main/logger.c: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.