GST_DEBUG: How to save logs in a separate file for a thread inside an application

醉酒当歌 提交于 2019-12-23 04:53:20

问题


I am running a sample program of gstreamer which is being called from a C++ application as a thread. Have set the GST_DEBUG=*:5 level to capture all the possible scenarios.

The application also prints lots and lots of logs on stdout and the gstreamer thread also does the same( the level 5 adds to the misery).

Question -- Is there a way to separate out the log printing of gstreamer thread in a file with the given debug level ?

Supplementary question -- Set the GST_DEBUG_FILE based on answer below answer but the file starts from some characters and not from GST_DEBUG like

0:00:00.000036045 ^[[335m21088^[[00m  0x8405800 ^[[37mLOG    ^[[00m ^[[00;01;33m           GST_DEBUG gstinfo.c:1329:for_each_threshold_by_entry:^[[00m category default matches pattern 0x8405570 - gets set to level 5  
0:00:00.000109741 ^[[335m21088^[[00m  0x8405800 ^[[32;01mINFO   ^[[00m ^[[00;01;31m            GST_INIT gst.c:613:init_pre:^[[00m Initializing GStreamer Core Library version 0.10.36  
0:00:00.000123496 ^[[335m21088^[[00m  0x8405800 ^[[32;01mINFO   ^[[00m ^[[00;01;31m            GST_INIT gst.c:614:init_pre:^[[00m Using library installed in /usr/lib/i386-linux-gnu 

Q2 How to remove these characters like "^[[" and start from GST ?

References
Found a similar question


回答1:


GST_DEBUG_FILE=/tmp/gst.log will put all the logging into that file, but for separate log for separate threads you will need to write your own loghandler. Have a look in gstinfo.c, and gst_debug_add_log_function.

As for your Q2, again, you will need to write your own loghandler if you want it to start from GST, since these other fields (timestamp, process-id, thread etc.) are included in the default loghandler. (again see gstinfo.c, gst_debug_log_default)




回答2:


It's been a while now but for anyone else wondering you can set GST_DEBUG_NO_COLOR=1 to remove those special characters.



来源:https://stackoverflow.com/questions/18429692/gst-debug-how-to-save-logs-in-a-separate-file-for-a-thread-inside-an-applicatio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!