Specify directory for Serilog rolling file path

前端 未结 1 1849
别跟我提以往
别跟我提以往 2021-01-12 22:01

Consider this app.config appSetting entry:


         


        
相关标签:
1条回答
  • 2021-01-12 22:26

    The best place for services to write their logs is %PROGRAMDATA% which, by default, is in C:\ProgramData\.

    Try:

    <add key="serilog:write-to:RollingFile.pathFormat"
         value="%PROGRAMDATA%\ServerService\Logs\log-{Date}.txt" />
    

    (Program Files is usually considered to be read-only, and writing stuff here will lead to oddities being left behind unexpectedly during uninstall.)

    0 讨论(0)
提交回复
热议问题