Vostok.Logging
HomeQuickstartModulesImplementations
1.0.0
1.0.0
  • Home
  • Quickstart
  • Guarantees
  • Configuration
  • Concepts and basics
    • Log interface
    • Log events
    • Syntax
      • Logging extensions
      • Message templates
      • Providing property values
    • Formatting
      • Output templates
      • Special properties
      • Format specifiers
    • Source context
    • Operation context
  • Modules
    • Abstractions
    • Configuration
    • Formatting
    • Console
    • File
    • Hercules
    • Context
    • Serilog
    • Log4net
    • NUnit
    • Microsoft
  • Implementations
    • Silent log
    • Console log
    • File log
    • Hercules log
  • Integrations
    • Serilog integration
    • Log4net integration
    • Microsoft logging integration
  • How-to guides
    • Using operation context
    • Using static log provider
    • Filtering events
    • Enriching events
    • Transforming events
    • Combining multiple logs
    • Custom output templates
    • External configuration rules
Powered by GitBook
On this page
  • Composing loggers hierarchy
  • Injecting loggers into code
  • Configuring individual loggers

Configuration

PreviousGuaranteesNextConcepts and basics

Last updated 5 years ago

This page describes approaches to configuration employed in Vostok.Logging.

Composing loggers hierarchy

There's no such thing as a log factory or log provider: there are just instances, and the only way to get one initially is to instantiate one of the available in code. Everything else is achieved with decorator-based extensions and interface methods:

  • multiple logs into one.

  • incoming events.

  • incoming events with properties.

  • Obtaining log instances tied to specific .

This approach may look unfamiliar to prior users experienced with . Indeed, it lacks additional flexibility offered by file-based configs but enables much easier setup for new applications.

Injecting loggers into code

It's preferable to inject log instances explicitly through constructors, either using a DI container or simply passing them manually. may be sufficient for simple applications, though.

Configuring individual loggers

Individual log instances (such as or ) are typically configured in code by passing a settings object. However, some implementations (namely ) also accept an arbitrary settings provider delegate that can be used to configure from external sources using library.

Also, simple filtering and enrichment rules can be supplied from .

ILog
implementations
Combining
Filtering
Enriching
source context
log4net
XML configuration files
Static log provider
console log
file log
file log
Vostok.Configuration
external configuration