aptible / supercronic

Cron for containers
MIT License
1.84k stars 112 forks source link

Color escape sequences are being quoted/escaped on Docker logs #55

Closed goetzc closed 4 years ago

goetzc commented 4 years ago

Running Supercronic directly in a Bash shell shows colors, but when inspecting docker logs, the Supercronic output is quoted or escaped which prevents showing the actual colors.

Compared to other Cron implementations like the Debian's default Cron implementation which doesn't quote/escape the output and shows the colors, whenever called directly from the shell or from docker logs.

This is the Supercronic output from within Bash inside Docker: image

Output from docker logs when using Supercronic: \x1b[1m\x1b[35m (0.5ms)\x1b[0m BEGIN" image

Output from docker logs when using Debian's Cron package: image

krallin commented 4 years ago

What's happening here is that Supercronic reads the log of your underlying program then emits it back (those are the colors that are mangled here, not Supercronic's own log coloring). I'd suggest turning off log coloring in the jobs you run in your crontab.

That said, if you do want the colors and don't care to have Supercronic wrap your logging, then I think the right solution would be to just let you turn off the log wrapping. I'll put up a PR for this.

krallin commented 4 years ago

67 will let you pass -passthrough-logs if you'd like Supercronic to just leave your logs alone.

goetzc commented 4 years ago

That is nice and useful, thank you @krallin!