Foveus.Serilog to send structured Serilog logs to Foveus.
This integration is for applications that already use Serilog.
If your application does not use Serilog, you do not need Foveus.Serilog. Use Foveus.SDK alone.
How it works
Foveus.SDK captures executions, context, metrics, batching, transport, and correlation.
Foveus.Serilog adds a Serilog sink so logs written through Serilog can be sent to Foveus.
Use both packages together for Serilog-first applications.
Install packages
Install both packages:During private beta, your package names or package source may be different. Use the package names and feed URL provided during onboarding.
Basic setup
Import the Foveus Serilog extension.Recommended setup
For Serilog-first applications, disable the built-in FoveusILogger provider so logs are not captured twice.
Keep using ILogger
You can keep using the standard.NET ILogger<T> APIs in a Serilog application.
.NET logging pipeline.
Foveus captures them through the Serilog sink:
Why disable the built-in logger provider?
In Serilog-first applications, you should usually disable the built-in FoveusILogger provider.
This does not mean you stop using ILogger<T>.
You can keep writing normal .NET logs:
Without Serilog
If you are not using Serilog, Foveus can captureILogger<T> logs through the SDK logger provider.
With Serilog
If your app uses Serilog,ILogger<T> logs can flow through Serilog’s normal .NET logging pipeline.
Foveus then captures them through the Serilog sink.
Why AddFoveus must run first
WriteTo.Foveus(services) uses dependency injection to get the Foveus services it needs.
It pulls dependencies such as:
FoveusClientFoveusOptionsIMetricsCollector
AddFoveus(...) must be registered before the Serilog sink is configured.
Correct order:
Appsettings example
A typical Serilog-first setup looks like this:What gets captured
For each Serilog log event, Foveus captures structured log data.Log level mapping
Foveus maps Serilog levels to Foveus log levels.Structured logging
Serilog structured properties are sent to Foveus. This works whether the log call is written through Serilog directly or throughILogger<T> in a Serilog-configured application.
Using ILogger<T>:
Use structured properties for values you want to inspect or correlate later.
Exception logging
Serilog exceptions are captured with the log event. UsingILogger<T>:
- exception type
- exception message
- stack trace
- inner exception chain
- rendered message
- structured properties such as
OrderId
Correlation
Foveus.Serilog tries to attach logs to the same execution, trace, and span as the rest of the telemetry.
It gets correlation from:
- the current Foveus metrics/execution context
System.Diagnostics.Activity.Current- generated fallback IDs
Foveus.SDK, logs can appear connected to requests, executions, traces, and errors in Foveus.
Using Serilog with ASP.NET Core
A typical setup for an ASP.NET Core API:Using Serilog without HTTP middleware
You can useFoveus.Serilog in applications that do not receive HTTP requests.
For example:
- console apps
- background jobs
- workers
- queue consumers
Worker service support is evolving.
Foveus.Serilog can send structured logs from workers today, but full worker execution capture is not yet the same as HTTP execution capture.Redaction and safety
Log events can contain sensitive data. Avoid logging secrets, credentials, tokens, card data, or highly sensitive personal data. Use structured properties carefully.Troubleshooting
Logs are duplicated
If the same logs appear twice, both Foveus logging paths may be enabled:- the Foveus SDK logger provider
- the Foveus Serilog sink
ILogger<T>, but disable the Foveus SDK logger provider.
Sink throws a setup error
Make sure you callAddFoveus(...) before configuring the sink.
Logs are not correlated to executions
Check that:app.UseFoveus()is registered for HTTP services- logs are written during the request or operation
- Activity/correlation context is available
WriteTo.Foveus(services)uses the app service provider- you are not building a separate service provider for Serilog
ILogger logs are not appearing
Check that your app is actually routingILogger<T> logs through Serilog.
In ASP.NET Core, make sure Serilog is configured on the host:
Logs do not appear
Check that:- both
Foveus.SDKandFoveus.Serilogare installed AddFoveus(...)is calledWriteTo.Foveus(services)is configured- the API key is valid
- the dashboard is showing the right mode
- the Serilog minimum level allows the event
- the service can reach Foveus
Too many logs are sent
Adjust Serilog minimum levels.What to do next
- Configure the SDK: SDK configuration
- Set up worker services: Worker services
- Review FoveusOptions: FoveusOptions
- Configure redaction: Redaction
- Review performance overhead: Performance overhead