2

I am running a web api and console apps on Net Core 3.1 on Windows 10 Professional. I have sinks for console, text file, json file, mssql, and seq. They each log all events, except seq does not log any event.

I installed Docker with the following command:

docker run -d --restart unless-stopped --name seq -e ACCEPT_EULA=Y -v D:\Logs\Seq:/data -p 8081:80 datalust/seq:latest

I created the logger with this code:

Log.Logger = new LoggerConfiguration()
    .MinimumLevel.Information()
    .MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
    .MinimumLevel.Override("System", LogEventLevel.Warning)
    .Enrich.FromLogContext()
    .Enrich.WithMachineName()
    .Enrich.WithEnvironmentUserName()
    .Enrich.WithProcessId()
    .Enrich.WithThreadId()
    .WriteTo.Console()
    .WriteTo.File($@"{Constants.LogsDirectory}log-.txt", LogEventLevel.Information, rollingInterval: RollingInterval.Day)
    .WriteTo.File(new JsonFormatter(), $@"{Constants.LogsDirectory}log-.json", rollingInterval: RollingInterval.Day)
    .WriteTo.MSSqlServer(DatabaseAccess.ConnectionString(context), nameof(ProcessMessageLog), columnOptions: columnOptions)
    .WriteTo.Seq("http://localhost:8081")
    .CreateLogger();

I see the following in my seq.json file in the D:\Logs\Seq directory:

  "api": {
    "listenUris": [
       "http://localhost:8081"
    ],

I also see log files written every minute, but none of them capture events from by web api or console apps.

When I go to localhost:8081, I get a "localhost refused to connect." message.

I suspect I have the port numbers wrong, but I don't know. Are they supposed to be different or the same between 1) the docker setup, 2) the seq.json value, 3) the logger creation?

Nicholas Blumhardt
  • 30,271
  • 4
  • 90
  • 101
David Stevens
  • 173
  • 1
  • 1
  • 8
  • Run `docker ps` command to ensure that `seq` container is status is up. If it is not try using some random port other than `8081` as this port may already in use causing the seq container to exit – Mohsin Mehmood Jan 28 '20 at 08:10

1 Answers1

1

It appears the Seq container in Docker does not play well with my micro SD card D: drive. I simply switched from that to my C: drive and it works fine.

David Stevens
  • 173
  • 1
  • 1
  • 8
  • Sounds like you are running Docker for Windows. Did you configure `Resources -> File Sharing` in the docker settings to share your D drive? – mdisibio Apr 09 '20 at 03:38