Exemplo n.º 1
0
void
elogMsgRaw(int level, const char *msg)
{
	lockLogFile();
	elogMsgRaw0(level, msg, TRUE);
	unlockLogFile();
}
Exemplo n.º 2
0
int
show_config_gtmProxy(int flag, int idx, char *hostname)
{
	char lineBuf[MAXLINE+1];
	char editBuf[MAXPATH+1];

	lineBuf[0] = 0;
	if (flag)
		strncat(lineBuf, "GTM Proxy: ", MAXLINE);
	if (hostname)
	{
		snprintf(editBuf, MAXPATH, "host: %s", hostname);
		strncat(lineBuf, editBuf, MAXLINE);
	}
	if (flag || hostname)
		strncat(lineBuf, "\n", MAXLINE);
	lockLogFile();
	if (lineBuf[0])
		elog(NOTICE, "%s", lineBuf);
	print_simple_node_info(aval(VAR_gtmProxyNames)[idx], aval(VAR_gtmProxyPorts)[idx],
						   aval(VAR_gtmProxyDirs)[idx], sval(VAR_gtmPxyExtraConfig),
						   aval(VAR_gtmPxySpecificExtraConfig)[idx]);
	unlockLogFile();
	return 0;
}
Exemplo n.º 3
0
int
show_config_gtmSlave(int flag, char *hostname)
{
	char lineBuf[MAXLINE+1];
	char editBuf[MAXPATH+1];

	if (!isVarYes(VAR_gtmSlave) || is_none(VAR_gtmSlaveServer))
	{
		elog(ERROR, "ERROR: gtm slave is not configured.\n");
		return 0;
	}
	lineBuf[0] = 0;
	if (flag)
		strncat(lineBuf, "GTM Slave: ", MAXLINE);
	if (hostname)
	{
		snprintf(editBuf, MAXPATH, "host: %s", hostname);
		strncat(lineBuf, editBuf, MAXLINE);
	}
	if (flag || hostname)
		strncat(lineBuf, "\n", MAXLINE);
	lockLogFile();
	elog(NOTICE, "%s", lineBuf);
	print_simple_node_info(sval(VAR_gtmName), sval(VAR_gtmSlavePort), sval(VAR_gtmSlaveDir),
						   sval(VAR_gtmExtraConfig), sval(VAR_gtmSlaveSpecificExtraConfig));
	unlockLogFile();
	return 0;
}
Exemplo n.º 4
0
void print_vars(void)
{
	pgxc_ctl_var *cur;

	lockLogFile();
	for(cur = var_head; cur; cur=cur->next)
		print_var(cur->varname);
	unlockLogFile();
}
Exemplo n.º 5
0
int
show_config_gtmProxies(char **nameList)
{
	int ii;

	lockLogFile();
	for(ii = 0; nameList[ii]; ii++)
		show_config_gtmProxy(TRUE, ii, aval(VAR_gtmProxyServers)[ii]);
	unlockLogFile();
	return 0;
}
Exemplo n.º 6
0
void
elogFinish(int level, const char *fmt, ...)
{
	char msg[MAXLINE+1];
	va_list arg;

	lockLogFile();
	if ((level >= logMsgLevel) || (level >= printMsgLevel))
	{
		va_start(arg, fmt);
		vsnprintf(msg, MAXLINE, fmt, arg);
		va_end(arg);
		elogMsgRaw(level, msg);
	}
	unlockLogFile();
}
Exemplo n.º 7
0
void
writeLogOnly(const char *fmt, ...)
{
	char msg[MAXLINE+1];
	va_list arg;

	if (logFile)
	{
		va_start(arg, fmt);
		vsnprintf(msg, MAXLINE, fmt, arg);
		va_end(arg);
		lockLogFile();
		fprintf(logFile, "%s(%d):%s %s", progname, getpid(), pgxcCtlGetTime(), msg); 
		fflush(logFile);
		unlockLogFile();
	}
}
Exemplo n.º 8
0
void
elogFileRaw(int level, char *path)
{
	FILE *f;
	char s[MAXLINE+1];

	lockLogFile();
	if ((f = fopen(path, "r")))
	{
		while(fgets(s, MAXLINE, f))
			elogMsgRaw0(level, s, FALSE);
		fclose(f);
	}
	else
		elog(ERROR, "ERROR: Cannot open \"%s\" for read, %s\n", path, strerror(errno));
	unlockLogFile();
}
Exemplo n.º 9
0
void
writeLogRaw(const char *fmt, ...)
{
	char msg[MAXLINE+1];
	va_list arg;

	va_start(arg, fmt);
	vsnprintf(msg, MAXLINE, fmt, arg);
	va_end(arg);
	if (logFile)
	{
		lockLogFile();
		fprintf(logFile, "%s(%d):%s %s", progname, getpid(), pgxcCtlGetTime(), msg); 
		fflush(logFile);
		unlockLogFile();
	}
	fputs(msg, logFile ? logFile : stderr);
	fflush(outF ? outF : stderr);
}
Exemplo n.º 10
0
/*
 * configuration --------------------------------------------------------------------
 */
int
show_config_gtmMaster(int flag, char *hostname)
{
	char lineBuf[MAXLINE+1];
	char editBuf[MAXPATH+1];

	lineBuf[0] = 0;
	if (flag)
		strncat(lineBuf, "GTM Master: ", MAXLINE);
	if (hostname)
	{
		snprintf(editBuf, MAXPATH, "host: %s", hostname);
		strncat(lineBuf, editBuf, MAXLINE);
	}
	if (flag || hostname)
		strncat(lineBuf, "\n", MAXLINE);
	lockLogFile();
	if (lineBuf[0])
		elog(NOTICE, "%s", lineBuf);
	print_simple_node_info(sval(VAR_gtmName), sval(VAR_gtmMasterPort), sval(VAR_gtmMasterDir),
						   sval(VAR_gtmExtraConfig), sval(VAR_gtmMasterSpecificExtraConfig));
	unlockLogFile();
	return 0;
}