question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

%AppData% folder not correctly replaced in appsettings.json

See original GitHub issue

I have the following appsettings.json:

"Serilog": {
    "Using":  [ "Serilog.Sinks.File" ],
    "MinimumLevel": "Debug",
    "WriteTo": [
      { "Name": "File", "Args": { "path": "%APPDATA%\\CompanyName\\ApplicationName.txt", "rollingInterval": "Day", "fileSizeLimitBytes": 26214400, "rollOnFileSizeLimit":  true } }
    ],
    "Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
    "Destructure": [
      { "Name": "ToMaximumDepth", "Args": { "maximumDestructuringDepth": 4 } },
      { "Name": "ToMaximumStringLength", "Args": { "maximumStringLength": 100 } },
      { "Name": "ToMaximumCollectionCount", "Args": { "maximumCollectionCount": 10 } }
    ],
    "Properties": {
      "Application": "Name"
    }
  },

and I initialize Serilog reading the resulting configuration. Anyway, the result is not exactly what I would expect (using the AppData system folder). I get instead an %AppData% folder created and containing the logs:

image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
skomis-mmcommented, Sep 4, 2019
0reactions
nblumhardtcommented, Sep 11, 2019

Aha! I’d forgotten about the progress on this, sorry 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

cannot find real location of %APPDATA%\Code\User\ ...
Settings file locations. Depending on your platform, the user settings file is located here: Windows %APPDATA%\Code\User\settings.json.
Read more >
Adding AppSettings.json Configuration to a .NET Core ...
This post will walk you through the steps necessary to add a strongly typed appsettings.json configuration file to your console application.
Read more >
Configure ASP.NET Core Data Protection
Learn how to configure Data Protection in ASP.NET Core.
Read more >
Configuration builders for ASP.NET
Learn how to get configuration data from sources other than web.config values from external sources.
Read more >
Secrets Management in .NET Applications
In this article, you have learned that using the default appsettings.json configuration file to store your .NET application's secrets is not a good...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found