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.

File based provider?

See original GitHub issue

Hiya,

This seems exactly what a was looking for. Only I have a File sink setup instead of sql. Would it be feasible to implement a file-based provider for serilog-ui?

An excerpt of my log file;

[10:20:51 INF] Sulis python based parser: null {"SourceContext":"Tdc.GenesisMachine.RemoteData.Shared.Windows.ProcessRunner"}
[10:20:51 INF] Process Sulis python based parser exited with exit code 0 at 19-2-2021 10:20:51 {"SourceContext":"Tdc.GenesisMachine.RemoteData.Shared.Windows.ProcessRunner"}
[10:20:51 INF] Done running {"Name":"Sulis python based parser","WaitForExit":true,"DurationMilliseconds":882.0070000000001,"TimeOutMilliseconds":0,"ExitedWhenWaitingForTimeout":false,"exitLogInfo":{"ExitCode":0,"ExitTime":"2021-02-19T10:20:51.9647150+01:00"}} {"SourceContext":"Tdc.GenesisMachine.RemoteData.Shared.Windows.ProcessRunner"}
[10:30:31 INF] Skipping download of remote file /StaticFiles/TemboAnalyticsLogs_20201023.zip, local file ...\Tembo Paper - KAMPEN (NL) - Sulis_P02378_Line1\TDCNL_0045~TemboAnalyticsLogs_20201023.zip was up to date, Local file size: 7116022 vs remote file size: 7116022 {"SourceContext":"Tdc.GenesisMachine.RemoteData.Shared.HangFireJobs.RemoteDataFilePuller"}
[10:30:31 INF] Skipping download of remote file /StaticFiles/TemboAnalyticsLogs_20201026.zip, local file ...\Tembo Paper - KAMPEN (NL) - Sulis_P02378_Line1\TDCNL_0045~TemboAnalyticsLogs_20201026.zip was up to date, Local file size: 7393688 vs remote file size: 7393688 {"SourceContext":"Tdc.GenesisMachine.RemoteData.Shared.HangFireJobs.RemoteDataFilePuller"}
[10:30:31 INF] Skipping download of remote file /StaticFiles/TemboAnalyticsLogs_20201027.zip, local file ...\Tembo Paper - KAMPEN (NL) - Sulis_P02378_Line1\TDCNL_0045~TemboAnalyticsLogs_20201027.zip was up to date, Local file size: 7628661 vs remote file size: 7628661 {"SourceContext":"Tdc.GenesisMachine.RemoteData.Shared.HangFireJobs.RemoteDataFilePuller"}

The logging config is as follows:

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information",
      "System.Net.Http.HttpClient": "Information",
      "Hangfire": "Information"
    }
  },
  "Serilog": {
    "Using": [ "Serilog.Sinks.Console" ],
    "WriteTo": [
      {
        "Name": "Console",
        "outPutTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} {Properties:j}{NewLine}{Exception}"
      },
      {
        "Name": "File",
        "Args": {
          "path": "%CUROUTDIR%\\..\\Logs\\RemoteData.WorkerService.txt",
          "rollingInterval": "Day",
          "rollOnFileSizeLimit": true,
          "retainedFileCountLimit": 31,
          "fileSizeLimitBytes": 5242880,
          "outPutTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} {Properties:j}{NewLine}{Exception}"
        }
      }
    ]
  }

I could of course change the template to something that would be easier to parse. I’d just like your opinion if something like this would be feasible and perhaps I take a crack at it.

Adding another provider for sql server for a fancy log viewer seems a bit too much consider the scope of my project. Although perhaps that’s a common solution.

In anyway I want to keep file based logging.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
mo-esmpcommented, Feb 19, 2021

@sommmen you need to implement IDataProvider interface for the file sink. Please check out other providers to see how they are implemented.

There are several issues that need to be considered:

  • Paging: how to calculate the total number of logs? (logs are saved in multiple files)
  • How to read logs via multiple files (for example, the log file for today contains 5 lines, and the log file last day contains 200 lines and for each page10 records should be displayed. now 5 lines from today’s log file and 5 logs from last day’s log file should be fetched)
  • If there were 15 pages and the user clicked on page 7, which file(s) should be opened to read logs?
0reactions
mo-esmpcommented, Feb 19, 2021
  • First fork the repo
  • Checkout dev branch
  • Create a feature branch
  • Merge feature branch into dev
  • Send a pull request
Read more comments on GitHub >

github_iconTop Results From Across the Web

File Providers in ASP.NET Core - Microsoft Learn
ASP.NET Core abstracts file system access through the use of File Providers. File Providers are used throughout the ASP.NET Core framework.
Read more >
Traefik File Documentation
The file provider in Traefik Proxy lets you define the dynamic configuration in a YAML or TOML file. Read the technical documentation.
Read more >
File Provider | Apple Developer Documentation
The file provider focuses on syncing data between the local copy and the remote storage—uploading any local changes and downloading any remote changes....
Read more >
Authorized IRS e-file Provider Locator Service For Tax ...
Identify and locate different types of Authorized IRS e-file Providers through interactive searches - e.g., Electronic Return Originators (EROs) ...
Read more >
Oracle Unified Directory - File Based Key Manager Provider
The File Based Key Manager Provider can be used to obtain the server certificate from a key store file on the local file...
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