Removed stdout printing of useless messages from maxkeys and maxpasswd.

This commit is contained in:
Markus Makela 2015-05-06 20:34:02 +03:00
parent dcd0098823
commit bb074d8f94
4 changed files with 29 additions and 26 deletions

View File

@ -2581,14 +2581,14 @@ static bool logfile_init(
}
#if defined(SS_DEBUG)
if (store_shmem)
if (store_shmem && !use_stdout)
{
fprintf(stderr, "%s\t: %s->%s\n",
STRLOGNAME(logfile_id),
logfile->lf_full_link_name,
logfile->lf_full_file_name);
}
else
else if(!use_stdout)
{
fprintf(stderr, "%s\t: %s\n",
STRLOGNAME(logfile_id),
@ -3135,7 +3135,7 @@ void flushall_logfiles(bool flush)
*/
void skygw_log_sync_all(void)
{
skygw_log_write(LOGFILE_TRACE,"Starting log flushing to disk.");
if(!use_stdout)skygw_log_write(LOGFILE_TRACE,"Starting log flushing to disk.");
flushall_logfiles(true);
skygw_message_send(lm->lm_logmes);
skygw_message_wait(lm->lm_clientmes);

View File

@ -33,18 +33,18 @@
#include <log_manager.h>
int main(int argc, char **argv)
{
int arg_count = 4;
int arg_count = 6;
char *home;
char** arg_vector;
int rval = 0;
if (argc != 2)
{
fprintf(stderr, "Usage: %s <filename>\n", argv[0]);
exit(1);
return 1;
}
arg_vector = malloc(sizeof(char*)*5);
arg_vector = malloc(sizeof(char*)*(arg_count + 1));
if(arg_vector == NULL)
{
@ -52,8 +52,8 @@ int main(int argc, char **argv)
return 1;
}
arg_vector[0] = strdup("logmanager");
arg_vector[1] = strdup("-j");
arg_vector[0] = "logmanager";
arg_vector[1] = "-j";
if ((home = getenv("MAXSCALE_HOME")) != NULL)
{
@ -65,12 +65,12 @@ int main(int argc, char **argv)
arg_vector[2] = strdup("/usr/local/mariadb-maxscale/log");
}
arg_vector[3] = "-o";
arg_vector[4] = NULL;
arg_vector[4] = "-l";
arg_vector[5] = "LOGFILE_ERROR";
arg_vector[6] = NULL;
skygw_logmanager_init(arg_count,arg_vector);
skygw_log_enable(LOGFILE_TRACE);
skygw_log_enable(LOGFILE_DEBUG);
free(arg_vector[0]);
free(arg_vector[1]);
free(arg_vector[2]);
free(arg_vector);
@ -78,11 +78,11 @@ int main(int argc, char **argv)
if (secrets_writeKeys(argv[1]))
{
fprintf(stderr, "Failed to encode the password\n");
exit(1);
rval = 1;
}
skygw_log_sync_all();
skygw_logmanager_done();
return 0;
return rval;
}

View File

@ -41,18 +41,18 @@ int
main(int argc, char **argv)
{
char *enc, *pw;
int arg_count = 4;
int arg_count = 6;
char *home;
char** arg_vector;
int rval = 0;
if (argc != 2)
{
fprintf(stderr, "Usage: %s <password>\n", argv[0]);
exit(1);
return 1;
}
arg_vector = malloc(sizeof(char*)*5);
arg_vector = malloc(sizeof(char*)*(arg_count + 1));
if(arg_vector == NULL)
{
@ -60,8 +60,8 @@ main(int argc, char **argv)
return 1;
}
arg_vector[0] = strdup("logmanager");
arg_vector[1] = strdup("-j");
arg_vector[0] = "logmanager";
arg_vector[1] = "-j";
if ((home = getenv("MAXSCALE_HOME")) != NULL)
{
@ -74,12 +74,12 @@ main(int argc, char **argv)
}
arg_vector[3] = "-o";
arg_vector[4] = NULL;
arg_vector[4] = "-l";
arg_vector[5] = "LOGFILE_ERROR";
arg_vector[6] = NULL;
skygw_logmanager_init(arg_count,arg_vector);
skygw_log_enable(LOGFILE_TRACE);
skygw_log_enable(LOGFILE_DEBUG);
free(arg_vector[0]);
free(arg_vector[1]);
free(arg_vector[2]);
free(arg_vector);
@ -87,7 +87,7 @@ main(int argc, char **argv)
if(pw == NULL){
fprintf(stderr, "Error: cannot allocate enough memory.");
exit(1);
return 1;
}
strncpy(pw,argv[1],80);
@ -96,10 +96,11 @@ main(int argc, char **argv)
printf("%s\n", enc);
}else{
fprintf(stderr, "Failed to encode the password\n");
rval = 1;
}
free(pw);
skygw_log_sync_all();
skygw_logmanager_done();
return 0;
return rval;
}

View File

@ -8,11 +8,13 @@
void init_test_env(char *path)
{
int argc = 3;
int argc = 5;
char* argv[] =
{
"log_manager",
"-l",
"LOGFILE_ERROR",
"-j",
path? path:TEST_LOG_DIR,
NULL