Redirect output from NV Gst elements

I’m running a C++ Gstreamer/Deepstream application on Jetson Nano (L4T version 32.3.1). I have all of my logging going to syslog. By using a custom log handler function and gst_debug_add_log_function, I have also configured all Gst logs to go to syslog.

However, NVIDIA Gst elements are apparently not using the Gst logging framework, and are still sending output to stdout. When I run a typical pipeline, I will, for instance, see something like this on the terminal:

Creating LL OSD context new
NvMMLiteOpen : Block : BlockType = 4 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 3264 x 2464 FR = 21.000000 fps Duration = 47619048 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 3264 x 1848 FR = 28.000001 fps Duration = 35714284 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1920 x 1080 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 120.000005 fps Duration = 8333333 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: Running with following settings:
   Camera index = 0 
   Camera mode  = 4 
   Output Stream W = 1280 H = 720 
   seconds to Run    = 0 
   Frame Rate = 120.000005 
GST_ARGUS: PowerService: requested_clock_Hz=627200000
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.

How can I also have these messages routed to syslog?

(Note: I would prefer not to have to do something clumsy like redirect all stdout/stderr, as we do use console output for other purposes.)

Nvidia’s stuff are macros IIRC (NVGSTDS_ERR_MSG_V, NVGSTDS_INFO_MSG_V, NVGSTDS_WARN_MSG_V). You’ll what you need in /opt/nvidia/deepstream/deepstream-4.0/sources/apps/apps-common/includes/deepstream_common.h at the top of the file.

Thanks @mdegans, I checked that out but unfortunately that’s not it either. Looks like those are used by the DS apps, but not the Gst plugins. The NVGSTDS_ERR… etc macros all use g_printf(), which I do have successfully redirected to syslog right now.

Thanks for the info though, got me looking through other bits of that code.

Hey, so if you’re gonna modify those plugins, it’s much appreciated. When you find the culprits, there are some gstreamer macros for logging you might use since you’ve already set up your custom handler (just in case you aren’t already aware of them).

I wish I could, but the Gst plugins in question are not part of the public code (Argus, NV encode, OSD…).

Can someone from NVIDIA please take a quick look at the code to see what mechanism is being used to send messages to the console, and if there’s any way to redirect them short of redirecting the entire terminal?

I have to say I’m a little baffled by this setup. These are shared libs, shipped as part of an embedded toolkit no less, with informational messages that only go to stdout? Could have used the existing Gst logging framework (which I was able to easily redirect), or go a level up and use the Glib logging framework (which I was able to redirect), or even just use syslog. The DeepStream apps have their own logging macros (why?), and use g_print which is still an odd choice but it at least has hooks to work with. But for the plugins - nothing.

Ya. It would have been nice, but maybe it can change in the next release. Put me down as a +1 for this request if it’s something Nvidia will consider.

Hi,
We follow gstreamer logging system. You can see different-level printing by setting

$ export GST_DEBUG=*:1(to 5)

Please give it a try.