This guide explains how to set up and configure logging in a .NET application, and how to send logs to Axiom.
AxiomLogs
.
Microsoft.AspNet.WebApi.Client
package to make HTTP requests to the Axiom API. Run the following command to install the package:
AxiomLogger.cs
in your project directory with the following content:
Program.cs
file and replace its contents with the following code:
axiomlogs.csproj
file is configured with the package reference. The file should look like this:
Log sent successfully.
for each log entry.
Serilog
, Serilog.Sinks.Http
, and Serilog.Formatting.Json
packages.
Program.cs
or a startup configuration file, set up Serilog to use the HTTP sink. Configure the sink to point to the Axiom ingestion API endpoint.
axiomlogs.csproj
file is configured with the package references. The file should look like this:
NLog.config
file or configuring it programmatically. Here is an example configuration for NLog
using an HTTP target:
NLog
. In your Program.cs
file:
axiomlogs.csproj
file is configured with the package references. The file should look like this: