---
name: "upscli_upslog_set_debug_level"
section: "3"
platform: "linux"
package: "nut"
version: "2.8.5-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/upscli_upslog_set_debug_level"
---

# upscli\_upslog\_set\_debug\_level(3)

manipulate the possibly separate (identified via cookie) copies of the \`nut\_debug\_level\` and sub-process tag variables in the \`libupsclient\` build

## NAME

upscli\_upslog\_set\_debug\_level, upscli\_upslog\_get\_debug\_level, upscli\_upslog\_cookie, upscli\_upslog\_setprocname, upscli\_upslog\_setproctag, upscli\_upslog\_getproctag, upscli\_upslog\_start\_sync - manipulate the possibly separate (identified via cookie) copies of the \`nut\_debug\_level\` and sub-process tag variables in the \`libupsclient\` build

## SYNOPSIS

```
        #include <upsclient.h>
        const void *upscli_upslog_cookie(void);
        void upscli_set_debug_level(int, const void *cookie);
        int  upscli_get_debug_level(void);
        void upscli_setprocname(const char *full_procname, const void *cookie);
        void upscli_setproctag(const char *tag, const void *cookie);
        const char *upscli_getproctag(void);
        struct timeval *upscli_upslog_start_sync(struct timeval *tv, const void *cookie);
```

## DESCRIPTION

On some platforms, *libupsclient* builds tend to get a built-in copy of the internal code from NUT *libcommon* library, so for NUT client programs using both libraries as dynamically-linked shared code, the nut\_debug\_level setting is backed by independent variables in active memory, and upsdebugx() calls suffer if the library’s copy is never changed from zero.

It can get even more confusing with libnutprivate-common being a shared dynamically loaded library instance behind both the program and libupsclient, hence the cookies: direct NUT-common code consumers like NUT in-tree clients can use their nut\_common\_cookie() value to pass into methods here. Third-party clients may safely pass *NULL*.

These methods allow to set or retrieve the value of nut\_debug\_level setting known by the *libupsclient* library, regardless of build mode.

The most likely use (at least in NUT programs) is to call upscli\_set\_debug\_level(nut\_debug\_level); after changing the original variable. Values of the debugging level are zero to disable debug, may be negative for a few special cases, and generally are positive numbers to cut off the more verbose logging attempts; otherwise it is up to the code base and NUT style guide practices to assign certain levels to some classes of messages.

If internal upslog\_start value is not yet set, we can set it with **upscli\_upslog\_start\_sync()** from \*tv (or current time if tv==NULL), otherwise the method is no-op (keep and report the original setting).

Returns the pointer to the currently set value, so it can be propagated or used in difftime() computations.

**Note**\

In WIN32 builds also enforces line-buffering for stdout and stderr streams.

## RETURN VALUE

There is no return value for the setter.

The getter returns the current value of the internal variable.

## SEE ALSO

[**upscli\_init**(3)](/upscli_init/3.md), [**upscli\_report\_build\_details**(3)](/upscli_report_build_details/3.md)
