1

I am trying to change my logging url and api key for different environments. For this, I am using the Variables, in my Azure release pipeline. At the moment, I have the database connection string working well.

enter image description here

However, I am struggling to get the logging variables to work. Now,there is an array, and I bvelieve you reference an array as field.child.1.field (So, that would assign the 2nd array objets's field.

I have this:

 "Serilog": {
    "MinimumLevel": {
      "Default": "Debug",
      "Override": {
        "Microsoft": "Warning",
        "System": "Warning"
      }
    },
    "Enrich": [ "FromLogContext", "WithMachineName", "WithProcessId", "WithThreadId" ],

    "WriteTo": [
      {
        "Name": "Console",
        "Args": {
          "outputTemplate": "[{Timestamp:HH:mm:ss.fff} {Level:u3}] {Message:lj}{NewLine}{Exception}"
        }
      },
      {
        "Name": "Seq",
        "Args": {
          "serverUrl": "myUrl",
          "apiKey": "myApiKey"
        }
      }
    ]
  }

I am trying to substitute the serverUrl and apiKey.

In my pipeline lok, all I see is:

  • 2021-03-15T01:24:13.1988119Z Compressed: 17363747
  • 2021-03-15T01:24:13.2942311Z Applying JSON variable substitution for **/*.json
  • 2021-03-15T01:24:13.3272676Z Applying JSON variable substitution for D:\a_temp\temp_web_package_8357506149\appsettings.json
  • 2021-03-15T01:24:13.3275828Z Substituting value on key: ConnectionString
  • 2021-03-15T01:24:13.3717239Z Applying JSON variable substitution for D:\a_temp\temp_web_package_8357506149\MyApp.WebAPI.deps.json
  • 2021-03-15T01:24:13.3819830Z Applying JSON variable substitution for D:\a_temp\temp_web_package_8357506149\MyApp.WebAPI.runtimeconfig.json
  • 2021-03-15T01:24:13.3822015Z JSON variable substitution applied successfully.

It does the ConnectionString one well, but doesn't do the others. What am I missing?

1 Answer 1

2

You understand it correctly. Your fault is the uppercase letter "L" in SeriLog.WriteTo.1.Args.apiKey. It should be "Serilog.WriteTo.1.Args.apiKey". The mistake is in both variables apiKey and serverUrl.

Sign up to request clarification or add additional context in comments.

2 Comments

You beautiful person! Case sensitivity. Arggh! Thank you! Solved.
@Craig oh, thank you :) Case sensitivity is a big "deal" in JSON. I spent many days troubleshooting because of it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.