[Visual Studio and vcpkg] Logger unable to open log file "k4a.log" #1987
Description
Hey,
Thank you in advance for your time and help!
Describe the bug
I use Visual Studio and installed the SDK with the embedded vcpkg
in manifest mode.
When trying to get a frame of my .mkv
Kinect video using the k4a_playback_get_next_capture
function, an exception occurs. It seems to be related to log files (The message <Logger unable to open log file "k4a.log"> appears in the terminal).
More detail
- The issue occurs regardless of whether the log environment variables are set to
0
or a specific location (both absolute and relative paths). When set to a specific location, bothk4a
andk4a_recorder
log files are created. Thek4a_recorder
log file contains some content ("New logging session started"), but thek4a
log file triggers an exception (Microsoft C++ exception: spdlog::spdlog_ex
). - In Debug mode (when not using the compiled
.exe
), I can bypass the exception by clicking the "Continue" button. After ignoring the exception, I can read all the frames of the video without any further issues. The exception only occurs during the first call tok4a_playback_get_next_capture
.
To Reproduce
- In Visual Studio, create a new terminal project
- In Visual Studio, enable manifest mode in the project (Project>Properties>vcpkg>Use vcpkg Manifest: "yes"
- In Visual Studio, View>terminal and type:
vcpkg new --application
vcpkg add port azure-kinect-sensor-sdk
- Replace the current main.cpp content by:
#include <k4a/k4a.h>
#include <k4arecord/playback.h>
int main(int argc, char** argv){
k4a_playback_t playback_handle = NULL;
if (k4a_playback_open("abs/path/to/video.mkv", &playback_handle) != K4A_RESULT_SUCCEEDED){
return 1;
}
k4a_capture_t capture = NULL;
k4a_playback_get_next_capture(playback_handle, &capture);
k4a_playback_close(playback_handle);
return 0;
}
- Set system environment variables to:
K4A_ENABLE_LOG_TO_A_FILE = 0
K4A_RECORD_ENABLE_LOG_TO_A_FILE = 0
K4A_LOG_LEVEL = w
orK4A_ENABLE_LOG_TO_A_FILE = logs/k4a.log
K4A_RECORD_ENABLE_LOG_TO_A_FILE = = logs/k4arecord.log
K4A_LOG_LEVEL = w
- In Visual Studio, Build the solution
- In Visual Studio, Start debugging
Expected behavior
I expected the log files to be ignored (with environment variables to 0) or to be filled as intended without triggering an error.
Desktop
- OS with Version: Windows 11 Home, Version 23H2, OS build 22631.4037
- SDK Version: azure-kinect-sensor-sdk:[email protected]
- Microsoft Visual Studio Community 2022, Version 17.11.0 (downloaded and installed the 12/08/2024)
Additional context
See the screenshot below.
Also, I have read/used:
https://learn.microsoft.com/en-us/azure/kinect-dk/record-playback-api
https://learn.microsoft.com/en-us/azure/Kinect-dk/troubleshooting#collecting-logs
#1015
Thank you!
Best,
Basil