Re: [PATCH 2/7] LOG: get logging to file working correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reviewed-by: Steven Dake <sdake@xxxxxxxxxx>

On 10/21/2011 12:57 AM, Angus Salkeld wrote:
> Signed-off-by: Angus Salkeld <asalkeld@xxxxxxxxxx>
> ---
>  exec/logsys.c     |   30 ++++++++++++++++++++++++------
>  exec/mainconfig.c |    8 ++++----
>  2 files changed, 28 insertions(+), 10 deletions(-)
> 
> diff --git a/exec/logsys.c b/exec/logsys.c
> index dc1d101..b6b16cb 100644
> --- a/exec/logsys.c
> +++ b/exec/logsys.c
> @@ -172,8 +172,7 @@ static int logsys_config_file_set_unlocked (
>  	}
>  
>  	logsys_loggers[subsysid].dirty = QB_TRUE;
> -	if ((file == NULL) ||
> -	    (strcmp(logsys_loggers[subsysid].subsys, "") == 0)) {
> +	if (file == NULL) {
>  		return (0);
>  	}
>  
> @@ -228,6 +227,7 @@ static int logsys_config_file_set_unlocked (
>  		*error_string = error_string_response;
>  		return (-1);
>  	}
> +	qb_log_format_set(logsys_loggers[subsysid].target_id, format_buffer);
>  	return (0);
>  }
>  
> @@ -498,6 +498,7 @@ int logsys_config_file_set (
>  int logsys_format_set (const char *format)
>  {
>  	int ret = 0;
> +	int i;
>  	int c;
>  	int w;
>  	int reminder;
> @@ -514,6 +515,12 @@ int logsys_format_set (const char *format)
>  	}
>  	qb_log_format_set(QB_LOG_STDERR, format_buffer);
>  
> +	for (i = 0; i <= LOGSYS_MAX_SUBSYS_COUNT; i++) {
> +		if (logsys_loggers[i].target_id > 0) {
> +			qb_log_format_set(logsys_loggers[i].target_id, format_buffer);
> +		}
> +	}
> +
>  	/*
>  	 * This just goes through and remove %t and %p from
>  	 * the format string for syslog.
> @@ -624,17 +631,28 @@ static void _logsys_config_apply_per_file(int32_t s, const char *filename)
>  			  QB_LOG_FILTER_FILE, filename, LOG_TRACE);
>  	qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_REMOVE,
>  			  QB_LOG_FILTER_FILE, filename, LOG_TRACE);
> +	if (logsys_loggers[s].target_id > 0) {
> +		qb_log_filter_ctl(logsys_loggers[s].target_id,
> +			QB_LOG_FILTER_REMOVE,
> +			QB_LOG_FILTER_FILE, filename, LOG_TRACE);
> +	}
>  
>  	if (logsys_loggers[s].debug) {
>  		syslog_priority = LOG_DEBUG;
>  		logfile_priority = LOG_DEBUG;
>  	}
>  	qb_log_filter_ctl(QB_LOG_SYSLOG, QB_LOG_FILTER_ADD,
> -			  QB_LOG_FILTER_FILE, filename,
> -			  syslog_priority);
> +		QB_LOG_FILTER_FILE, filename,
> +		syslog_priority);
>  	qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_ADD,
> -			  QB_LOG_FILTER_FILE, filename,
> -			  logfile_priority);
> +		QB_LOG_FILTER_FILE, filename,
> +		logfile_priority);
> +	if (logsys_loggers[s].target_id > 0) {
> +		qb_log_filter_ctl(logsys_loggers[s].target_id,
> +			QB_LOG_FILTER_ADD,
> +			QB_LOG_FILTER_FILE, filename,
> +			logfile_priority);
> +	}
>  }
>  
>  static void _logsys_config_apply_per_subsys(int32_t s)
> diff --git a/exec/mainconfig.c b/exec/mainconfig.c
> index 2db9a53..d406428 100644
> --- a/exec/mainconfig.c
> +++ b/exec/mainconfig.c
> @@ -338,10 +338,6 @@ static int corosync_main_config_set (
>  	}
>  
>  	if (corosync_main_config_log_destination_set (objdb, object_handle, subsys, &error_reason,
> -	    "to_logfile", LOGSYS_MODE_OUTPUT_FILE, 0, NULL) != 0)
> -		goto parse_error;
> -
> -	if (corosync_main_config_log_destination_set (objdb, object_handle, subsys, &error_reason,
>  	    "to_stderr", LOGSYS_MODE_OUTPUT_STDERR, 0, NULL) != 0)
>  		goto parse_error;
>  
> @@ -408,6 +404,10 @@ static int corosync_main_config_set (
>  		}
>  	}
>  
> +	if (corosync_main_config_log_destination_set (objdb, object_handle, subsys, &error_reason,
> +	    "to_logfile", LOGSYS_MODE_OUTPUT_FILE, 0, NULL) != 0)
> +		goto parse_error;
> +
>  	if (!objdb_get_string (objdb,object_handle, "logfile_priority", &value)) {
>  		int logfile_priority;
>  

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux