mtkennerly / shawl

Windows service wrapper for arbitrary commands

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Separating shawl logs from the wrapped executable STDOUT logs

lachlan opened this issue · comments

I'd really like to be able to send the STDOUT logs from the wrapped executable/command to a different log file than the one used for shawl logging. It'd also be great if the executable's log file name/directory could be configured, and the format used.

For example, the project I'm working on has an executable which already formats logs in its own way with a datetime and debug/info/warn/error level etc., so having those log statements wrapped inside shawl log statements increases the size of the statement and makes the statements harder to read (especially when carriage returns and other special characters get escaped).

My ideal scenario would be to configure shawl to write its own logs to ./logs/shawl.log, and then the wrapped executable's STDOUT gets written to a different log file such as ./logs/<executable_name>.log with no additional formatting applied.

In the next release, you'll be able to use this combination of options to accomplish that:

--log-dir C:\path\to\service\logs --log-as shawl --log-cmd-as my-service

Which will result in two sets of log files:

  • C:\path\to\service\logs\shawl_rCURRENT.log (for Shawl itself, logged with the current template)
  • C:\path\to\service\logs\my-service_rCURRENT.log (for the wrapped command, logged as-is)

They'll use the same log dir, rotation, and retention, but I can add separate options for that if there's interest.

Awesome, thank you!