X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=registry.cpp;h=1b85af588f55d160f29e40b31d145a9254836031;hb=cc956aacde93d93f5810ca4c0df7775d1bfe3458;hp=c78cb8cfa3551dd75c6fa63021b130adb831e679;hpb=ac8cdc8a64606b7027344c8fd4d5f7f9bc871e90;p=nssm.git diff --git a/registry.cpp b/registry.cpp index c78cb8c..1b85af5 100644 --- a/registry.cpp +++ b/registry.cpp @@ -166,6 +166,8 @@ int create_parameters(nssm_service_t *service, bool editing) { if (service->stderr_copy_and_truncate) set_createfile_parameter(key, NSSM_REG_STDERR, NSSM_REG_STDIO_COPY_AND_TRUNCATE, 1); else if (editing) delete_createfile_parameter(key, NSSM_REG_STDERR, NSSM_REG_STDIO_COPY_AND_TRUNCATE); } + if (service->timestamp_log) set_number(key, NSSM_REG_TIMESTAMP_LOG, 1); + else if (editing) RegDeleteValue(key, NSSM_REG_TIMESTAMP_LOG); if (service->hook_share_output_handles) set_number(key, NSSM_REG_HOOK_SHARE_OUTPUT_HANDLES, 1); else if (editing) RegDeleteValue(key, NSSM_REG_HOOK_SHARE_OUTPUT_HANDLES); if (service->rotate_files) set_number(key, NSSM_REG_ROTATE, 1); @@ -667,6 +669,7 @@ void override_milliseconds(TCHAR *service_name, HKEY key, TCHAR *value, unsigned if (! ok) *buffer = default_value; } +/* Open the key of the service itself Services\. */ HKEY open_service_registry(const TCHAR *service_name, REGSAM sam, bool must_exist) { /* Get registry */ TCHAR registry[KEY_LENGTH]; @@ -678,6 +681,7 @@ HKEY open_service_registry(const TCHAR *service_name, REGSAM sam, bool must_exis return open_registry_key(registry, sam, must_exist); } +/* Open a subkey of the service Services\\. */ long open_registry(const TCHAR *service_name, const TCHAR *sub, REGSAM sam, HKEY *key, bool must_exist) { /* Get registry */ TCHAR registry[KEY_LENGTH]; @@ -826,9 +830,17 @@ int get_parameters(nssm_service_t *service, STARTUPINFO *si) { else service->rotate_stdout_online = service->rotate_stderr_online = false; } else service->rotate_stdout_online = service->rotate_stderr_online = false; + /* Log timestamping requires a logging thread.*/ + unsigned long timestamp_log; + if (get_number(key, NSSM_REG_TIMESTAMP_LOG, ×tamp_log, false) == 1) { + if (timestamp_log) service->timestamp_log = true; + else service->timestamp_log = false; + } + else service->timestamp_log = false; + /* Hook I/O sharing and online rotation need a pipe. */ - service->use_stdout_pipe = service->rotate_stdout_online || hook_share_output_handles; - service->use_stderr_pipe = service->rotate_stderr_online || hook_share_output_handles; + service->use_stdout_pipe = service->rotate_stdout_online || service->timestamp_log || hook_share_output_handles; + service->use_stderr_pipe = service->rotate_stderr_online || service->timestamp_log || hook_share_output_handles; if (get_number(key, NSSM_REG_ROTATE_SECONDS, &service->rotate_seconds, false) != 1) service->rotate_seconds = 0; if (get_number(key, NSSM_REG_ROTATE_BYTES_LOW, &service->rotate_bytes_low, false) != 1) service->rotate_bytes_low = 0; if (get_number(key, NSSM_REG_ROTATE_BYTES_HIGH, &service->rotate_bytes_high, false) != 1) service->rotate_bytes_high = 0;