Skip to content

TheRichCarey/AzLog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azlog

Azure Function in C#, designed to be an endpoint for NLOG remote logging using NLOGs Web Service logging target.

This is the final output of the blog post: here

Creating the settings file

To test locally, or deploy you will need to create the excluded file local.settings.json at the root.

{
    "IsEncrypted": false,
    "Values": {
        "AzureWebJobsStorage": "",
        "FUNCTIONS_WORKER_RUNTIME": "dotnet",
        "MyCosmosDBConnection": "<your connection string>"
    }
}

Updating NLOG targets

See the blog post for information, but essentially:

<target type='WebService'
            name='azurelogger'
            url='http://localhost:7071/api/Log'
            protocol='HttpPost'
            encoding='UTF-8'   >
      <parameter name='timestamp' type='System.String' layout='${longdate}'/>
      <parameter name='loggerName' type='System.String' layout='${logger}'/>
      <parameter name='loggerLevel' type='System.String' layout='${level}'/>
      <parameter name='message' type='System.String' layout='${message}'/>
    </target>

and then have one of your NLOG loggers use the azurelogger target. The URL should be changed to a localhost URL for local testing, or the azurewebsites url for Azure deployment.

Releases

No releases published

Packages

No packages published

Languages