Skip to content
This repository was archived by the owner on Aug 22, 2024. It is now read-only.
This repository was archived by the owner on Aug 22, 2024. It is now read-only.

[Visual Studio and vcpkg] Logger unable to open log file "k4a.log"  #1987

@bas1l

Description

@bas1l

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, both k4a and k4a_recorder log files are created. The k4a_recorder log file contains some content ("New logging session started"), but the k4a 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 to k4a_playback_get_next_capture.

To Reproduce

  1. In Visual Studio, create a new terminal project
  2. In Visual Studio, enable manifest mode in the project (Project>Properties>vcpkg>Use vcpkg Manifest: "yes"
  3. In Visual Studio, View>terminal and type:
    • vcpkg new --application
    • vcpkg add port azure-kinect-sensor-sdk
  4. 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;
}
  1. Set system environment variables to:
    • K4A_ENABLE_LOG_TO_A_FILE = 0
    • K4A_RECORD_ENABLE_LOG_TO_A_FILE = 0
    • K4A_LOG_LEVEL = w
      or
    • K4A_ENABLE_LOG_TO_A_FILE = logs/k4a.log
    • K4A_RECORD_ENABLE_LOG_TO_A_FILE = = logs/k4arecord.log
    • K4A_LOG_LEVEL = w
  2. In Visual Studio, Build the solution
  3. 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:x64-windows@1.4.1
  • 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

overall

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingCode SampleThis issue is related to a code sampleTriage NeededThe Issue still needs to be reviewed by Azure Kinect team members.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions