mtkennerly / shawl

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

I don't get log file per service #39

Closed janhoy closed 10 months ago

janhoy commented 10 months ago

Thanks for this project. I was finding NSSM buggy so I switched to this. Much faster and more stable.

I managed to place logs in a different folder. I run two services "s1" and "s2", and was expecting a log file for each, i.e. shawl_for_s1.log and shawl_for_s2.log. But instead I get one file shawl_for_Shawl_rCURRENT.log, which seems like a bug?

mtkennerly commented 10 months ago

Hi! On my end, it does produce a file with the service name, even with a custom log dir:

$ shawl add --name s2 --log-dir C:/tmp/shawl-log -- C:/git/shawl/target/debug/shawl-child.exe
$ sc start s2
$ ls C:/tmp/shawl-log
shawl_for_s2_rCURRENT.log

Could you run sc qc s1 and sc qc s2 to double check the BINARY_PATH_NAME? The filename infix is determined by the --name argument. For example, I have:

        BINARY_PATH_NAME   : C:\git\shawl\target\debug\shawl.exe run --name s2 --log-dir \\?\C:\tmp\shawl-log -- C:/git/shawl/target/debug/shawl-child.exe

--name is optional for run (required for add) and will default to Shawl. Maybe you forgot to specify it when creating the services?

mtkennerly commented 10 months ago

Ah, I see the README doesn't mention --name in the example of creating a service by using sc directly. I'll add that to the example.

janhoy commented 10 months ago

Yes, I create with sc. So when adding --name %SERVICE_NAME% it works. Could not shawl sniff the service name from its environment somehow to default to something? Anyway, I'm happy, closing.