anacrolix / dms

A UPnP DLNA Digital Media Server that includes basic video transcoding. Tested on a Panasonic Viera television, several Android UPnP apps, and Chromecast.
BSD 3-Clause "New" or "Revised" License
647 stars 97 forks source link

new command line option to customize the location of transcode logs #117

Closed irsl closed 1 year ago

irsl commented 1 year ago

This change also addresses the issue raised in https://github.com/anacrolix/dms/pull/113, when user lookup fails in a docker container, logging will be silently turned off (instead of panicing). Tested with the following dynamic stream:

"Command": "bash -c 'echo stdout; >&2 echo stderr'"

Some earlier formatting mistakes (of mine) should also be fixed in README.rst.

anacrolix commented 1 year ago

Could you move all the path resolution stuff to the earliest point possible? That includes stderrPath and TranscodeLogPath. That way you can handle errors resolving the user home etc. where it's suitable too. Also the special casing for /dev isn't ideal, is there someway to improve or remove that? I would rather another flag or something for that.

irsl commented 1 year ago

How about calling it -transcodeLogPattern that would support a [tsName] placeholder to be substituted in serveDLNATranscode? This aproach would fit well the following use cases:

The last one is useful in a container environment where the container runtime takes care about log rotation/retention.

anacrolix commented 1 year ago

That sounds fair. Can you do that with resolving it early too? Expose the necessary configuration fields wherever they're used and compute their values after flag parsing rather than on on demand for each log site.

irsl commented 1 year ago

Yup, that will require adding a new user in Dockerfile - otherwise early resolution would break it, even if transcoding is never used. I will take care of that.

irsl commented 1 year ago

Refactored as discussed. TDD of the early error before the Dockerfile is adjusted:

root@a798962a645e:/data/fileserver-geza/dms# docker run --rm -it dmsx
2023-04-02T19:14:55+0000 NIL [main.getDefaultFFprobeCachePath:83]: user: unknown userid 1000
2023/04/02 19:14:55 error in main: unable to resolve current user: "user: unknown userid 1000"