Suggested approaches for file paths when running on various platforms (Linux/Windows)
130 views
Skip to first unread message
Erick Thompson
unread,
Jan 27, 2017, 2:51:47 PM1/27/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Serilog
Hey,
I have a number of applications that log to file (usually rolling file). These applications are .net core, and will be deployed to both Windows and Linux containers. The application works great, but I'm not sure how to deal with file paths. For example, I want Windows to log "c:\logs\foo" and on Linux "\var\logs\foo". What is the suggested approach to dealing with platform specific file paths?
Thanks,
Erick
nblum...@nblumhardt.com
unread,
Jan 27, 2017, 4:04:24 PM1/27/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Serilog
Hi Erick,
Writing the path into a config file (e.g. appsettings.json), or passing it as an environment variable, is the way to go here.
Hope this helps!
Nick
Erick Thompson
unread,
Jan 31, 2017, 11:58:03 PM1/31/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Serilog
Thanks Nick, that makes sense.
I'm going to test the generation of filenames in Serilog (e.g., Rolling file). Hopefully it will just work out of the box :)