Build status NuGet Samples

Logging to from Logary

Logary is a semantic logging framework like Serilog and Microsoft Semantic Logging. Combining semantic logs with are a perfect fit, since has been designed with semantics from the ground up.

In this tutorial, we’ll add Logary to a Console application, but the process is almost identical with other project types. Create a new console application and add the target for Logary:

Install-Package Logary.Targets.Elmah.Io

Configuration in F#

Configure just like you would any normal target:

withTargets [
  // ...
  ElmahIO.create { ElmahIO with logId = "LOG_ID" } ""
] >>
withRules [
 // ...
 Rule.createForTarget ""

where LOG_ID is the id of your log (Where is my log ID?).

Configuration in C#

Configuration in C# is just as easy:

  conf => conf.Target.SendTo(apiKey: "LOG_ID"))

where LOG_ID is the id of your log.


To start logging messages to, you can use the following F# code:

let logger = logary.getLogger (PointName [| "Logary"; "Samples"; "main" |])

Message.event Info "User logged in"
  |> Message.setField "userName" "haf"
  |> Logger.logSimple logger

or in C#:

var logger = logary.GetLogger("Logary.CSharpExample");
logger.LogEventFormat(LogLevel.Fatal, "Unhandled {exception}!", e);

This article was brought to you by the team. is the best error management system for .NET web applications. We monitor your website, alert you when errors start happening and help you fix errors fast.

See how we can help you monitor your website for crashes Monitor your website