[CRIU] [PATCH] service: create /var/log/criu.log by default, if going daemon and no logfile is specified

Kir Kolyshkin kir at parallels.com
Wed Feb 12 14:04:47 PST 2014


On 02/12/2014 02:05 AM, Pavel Emelyanov wrote:
> On 02/11/2014 07:30 PM, Ruslan Kuprieiev wrote:
>
> Kir, what do you think?

First, this patch kills a way to disable logging. Second, a daemon is 
usually
started by some script so all defaults can be easily added there, no need
to hardcode anything.

>
> Ruslan, even if we continue with it we need to patch page-server with the same.
>
>> Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
>> ---
>>   cr-service.c               | 6 ++++++
>>   include/cr-service-const.h | 1 +
>>   2 files changed, 7 insertions(+)
>>
>> diff --git a/cr-service.c b/cr-service.c
>> index 1dec4af..c57cc6e 100644
>> --- a/cr-service.c
>> +++ b/cr-service.c
>> @@ -597,6 +597,12 @@ int cr_service(bool daemon_mode)
>>   			pr_perror("Can't run service server in the background");
>>   			goto err;
>>   		}
>> +
>> +		if (!opts.output) {
>> +			log_fini();
>> +			if (log_init(CR_DEFAULT_SERVICE_LOGFILE))
>> +				goto err;
>> +		}
>>   	}
>>   
>>   	if (opts.pidfile) {
>> diff --git a/include/cr-service-const.h b/include/cr-service-const.h
>> index 668882b..dbf7ab4 100644
>> --- a/include/cr-service-const.h
>> +++ b/include/cr-service-const.h
>> @@ -3,5 +3,6 @@
>>   
>>   #define CR_MAX_MSG_SIZE 1024
>>   #define CR_DEFAULT_SERVICE_ADDRESS "/var/run/criu_service.socket"
>> +#define CR_DEFAULT_SERVICE_LOGFILE "/var/log/criu.log"
>>   
>>   #endif /* __CR_SERVICE_CONST_H__ */
>>
>



More information about the CRIU mailing list