fix: Convert CMake booleans to C integers for file/console logging flags#859
Merged
Nox-MSFT merged 1 commit intofeature/vnext-deltafrom Apr 21, 2026
Merged
Conversation
The ADUC_ENABLE_FILE_LOG and ADUC_ENABLE_CONSOLE_LOG CMake options (ON/OFF) were passed directly to add_definitions, producing -DADUC_ENABLE_FILE_LOG=ON. In C, #if ON evaluates the undefined identifier ON as 0, silently disabling file logging entirely. Convert to 1/0 so the preprocessor guards in src/logging/zlog/src/init.c work correctly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Nox-MSFT
approved these changes
Apr 21, 2026
Collaborator
Nox-MSFT
left a comment
There was a problem hiding this comment.
Thanks for the fix @hmmorales
Nox-MSFT
added a commit
that referenced
this pull request
Apr 27, 2026
Merge feature/vnext-delta into develop New Features - Delta Download Handler — Component-based packaging with CacheSourceUpdate API for pre-reboot source file caching, hash verification, and bandwidth savings logging - CrossProc Query API SDK — Out-of-proc SDK wrapper with idle pause timer and examples - X.509 Certificate Support — Dual certificate auth, interactive demo script, and comprehensive documentation (#763, #764, #770) - SWUpdate v2 Handler — Custom extended result codes, workflow-id passthrough, and new Yocto reference scripts - V2 Content Downloader Contract — Backward-compatible V2 contract with V1/V2 routing - Reboot Synchronization — Lock-based coordination to allow agent cleanup before restart, preventing lost telemetry and state corruption Bug Fixes - Fix memory leak when initializing zlog multiple times (#801) - Fix segmentation fault (#844) - Fix double-free in logging library (#843) - Fix ARM32 segfault in extension registration — wrong format specifier for long on 32-bit (#841) - Fix wrong documentation — off-by-one array access (#808) - Fix CMake boolean-to-C conversion silently disabling file logging (#859) - Fix feof() bug in system_utils.c causing 0-byte file copies - Fix curl downloader default and add connect-timeout with diagnostic logging (#839) - Report detailed error result and ExtendedResultCode for failed workflows (#804, #805) Platform & Build - Add Ubuntu 24.04 LTS support with GCC 13 (#802) - Fix delta library build on Debian 13 / Ubuntu 24.04 (GCC 14 compatibility) - ARM32 compatibility fixes with QEMU-based CI (#841) - Docker build matrix: remove Debian 10, add Debian 12 - Incremental build optimization with hash-based result.h caching - Make zlog ref_count thread-safe using atomic operations - Shellcheck fixes across all shell scripts (#840) Documentation - Landing page rewrite with architecture overview, quick-start, and configuration guide - 1.2.0 and 1.3.0-rc1 changelogs - Updated platform support and build instructions for all supported distributions Validation — Build: 344 targets ✅ | Tests: 702/702 ✅ Co-authored-by: jw-msft <84477130+jw-msft@users.noreply.github.com> Co-authored-by: AndreRicardo-Zoetis <122284839+AndreRicardo-Zoetis@users.noreply.github.com> Co-authored-by: Martin Rieva <martin.rieva@zoetis.com> Co-authored-by: yinaliu <yinaliu@microsoft.com> Co-authored-by: whereiseva <liuyinan0309@gmail.com> Co-authored-by: Henry Morales <henrymorales@microsoft.com> Co-authored-by: hmmorales <100385146+hmmorales@users.noreply.github.com> Co-authored-by: Dan Mirsky <mirskiy@gmail.com> Co-authored-by: Daniel Mirsky <danielmirsky@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Chinonso Chukwuogor <nonsochukwuogor@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: Convert CMake booleans to C integers for file/console logging flags
🐛 Problem
Commit
b7e5e8b0("Allow build.sh to disable logging. #796") added#if ADUC_ENABLE_FILE_LOGpreprocessor guards insrc/logging/zlog/src/init.c, butsrc/CMakeLists.txtpasses the raw CMake boolean:In C,
#if ONevaluates the undefined identifierONas0, silently disabling all file logging at compile time.Customer impact: No ADU agent log files were created on the
vnext\deltabranch. Onlysw-update.log(written by the swupdate handler's shell script, independent of zlog) was visible.✅ Fix
Changed file:
src/CMakeLists.txtConvert CMake booleans (
ON/OFF) to C integers (1/0):Same pattern applied to
ADUC_ENABLE_CONSOLE_LOG.📋 Customer follow-up
After rebuilding with this fix, log files will be written to
/var/log/adu/. The customer should update theirdu-diagnostics-config.jsonlogPathto/var/log/adu/to match, or rebuild with-DADUC_LOG_FOLDER="/adu/logs"to match their existing config.