Is the Nx Cloud up? Visit our Status Page for the current health and performance of the Nx Cloud.

Status Page

Metadata Integration Unable to see std::cout

Answered

Comments

4 comments

  • Andrey Terentyev
    • Network Optix team

    Hello Yingyu,

    NX_OUTPUT and NX_PRINT are macros defined in nx/kit/debug.h. You should include this header in your code in order to use these macros.

    Please, read carefully this thread on output redirection. It explains how to see Server's output messages.

    https://support.networkoptix.com/hc/en-us/community/posts/360051982553-NetworkOptix-stdout-stderr-in-Windows

    0
  • Permanently deleted user

    Hello Andrey,

    Thanks for replying.

    But I am using Ubuntu, I am not sure if the example for Windows is applicable?
    I have tried to include the following:

    #define NX_DEBUG_ENABLE_OUTPUT true 
    #define NX_PRINT
    #include <debug.h>

    bool DeviceAgent::pushUncompressedVideoFrame(const IUncompressedVideoFrame* videoFrame)
    {
    m_terminated = m_terminated || m_objectDetector->isTerminated();
    NX_PRINT <<"item in buffer!";
    NX_OUTPUT <<"item in buffer output!";

    ...

    And the compiled error was:

    error: expected primary-expression before '<<' token
    NX_PRINT << "item in buffer!";/opt/networkOptix/nx_open_integrations/cpp/vms_server_plugins

    I need some help here.. thanks
    Best,
    Yingyu

    0
  • Andrey Terentyev
    • Network Optix team

    Yingyu,

    Which version of the SDK are you using?

    Please, read this post on output redirection.
    https://support.networkoptix.com/hc/en-us/community/posts/360051982553/comments/360013336354.

    It seems, the directory the  <debug.h> is not in your include directory list. There is something with your build environment.

    Try this to make sure it's working.

    1. Put the lines

    NX_PRINT << "item in buffer!";
    NX_OUTPUT << "item in buffer output!";

    in the pushUncompressedVideoFrame of the metadata_sdk/samples/sample_analytics_plugin/src/nx/vms_server_plugins/analytics/sample/device_agent.cpp

    2. change to the metadata_sdk folder

    3. run ./build_samples.sh

    Make sure the plugins are built.

    0
  • Permanently deleted user

    Dear Andrey,

    Thanks for the reply, after much trial and error, finally figured out, hoping to help others on this, shall share the steps here:

    • System: Ubuntu 18.04 
    • Nx Version: 4.1.0.31466 R9

    Step 1: Add the below lines into the cpp:

    #define NX_PRINT_PREFIX (this->logUtils.printPrefix)
    #include <nx/kit/debug.h>
    #include <nx/kit/utils.h>

    Step 2: Rebuild with ./build.sh

    Step 3: Run the plugin in Network Optix

    Step 4: Thanks to this post, type this command to see the debug message

    https://support.networkoptix.com/hc/en-us/community/posts/360029596654-debug-log-in-stub- 

    journalctl -u networkoptix-metavms-mediaserver.service -n <number of lines>

    Step 5: Look at the output you should see your debug message

    Thanks, and happy coding!


    Best,
    Yingyu

    0

Please sign in to leave a comment.