Debug file rotation

I’m using GStreamer with GStreamer-Sharp in a .NET web app. I’m using GST_DEBUG_FILE for logging. It works ok, but I want to do some enhancements.

The application functionality is rather long-running (security camera system) and ideally I’d like to be able to rotate logs daily. Is there any way to do this built into GStreamer?

I suspect one way is I’d probably need to stop all GStreamer functionality at the end of the day and then start it again. In addition, I’d either have to copy the old log file to a different filename or maybe make use of %p and %r within GST_DEBUG_FILE to generate a unique filename. But really I don’t want to restart GStreamer since I’d rather not interrupt this functionality unless absolutely necessary.

Or perhaps a symbolic link would work? I know Windows supports them. Just have GST_DEBUG_FILE set to the link filename and every day change the link to point to a different file. But I don’t know what’s going to happen if the link changes to point to a new file when it’s in the middle of logging. I’m unsure if I can reliably test that to see what happens.

Well, the symlink idea didn’t work for me, so that’s apparently not an option.

I would register my own log function with gst_debug_add_log_function() (assuming that’s supported by the bindings) and then handle the writing to file yourself.

You may also want to remove the default log handler then with gst_debug_remove_log_function(), if supported by the bindings.

Thanks. I’ll look into that.