Metadata Integration Unable to see std::cout
AnsweredDear NxOptix,
Please see below code, I just wanted to print out the debug message on my console, but I am facing difficulties in doing so, could you share with me a function that I can do so?
I tried:
std::cout << "this is a new frame" << std::endl; //Can compile but not shown on console
NX_OUTPUT << "this is a new frame" //Cannot compile
NX_PRINT << "this is a new frame" //Cannot compile
Thanks
Best,
Yingyu
-
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.
0 -
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_pluginsI need some help here.. thanks
Best,
Yingyu0 -
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 folder3. run ./build_samples.sh
Make sure the plugins are built.
0 -
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,
Yingyu0
Please sign in to leave a comment.
Comments
4 comments