mtkennerly / shawl

Windows service wrapper for arbitrary commands
MIT License
448 stars 15 forks source link

Separating shawl logs from the wrapped executable STDOUT logs #42

Closed lachlan closed 7 months ago

lachlan commented 7 months ago

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.

mtkennerly commented 7 months ago

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:

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

lachlan commented 7 months ago

Awesome, thank you!