-
Notifications
You must be signed in to change notification settings - Fork 14
Logging
In its most basic form, logging for web services needs to have a few important pieces of information: some way to identify which request a log message was generated from, a time stamp stored in UTC, the severity of the log message (i.e., if it is a fatal error, error, warning, informational, or diagnostic), and finally the message text itself. It should be possible to quickly scan through any file-based log to collect all the messages that were relevant to a given user request. Logging must be thread safe and cannot impose a performance penalty in highly threaded environments.
The goal in implementing logging within Harmony Core has been to ensure that logging calls are as cheap as possible when the relevant logging level is disabled. This means that, as an overall philosophy, users of the library and the library itself should not be making expensive calls as part of the parameters to a logging call. Expensive calls can be hidden within Object.ToString()
, where the cost is deferred until it has been decided to perform the logging operation.
- File - This is a streaming JSON file, which is human readable and machine readable. Since we include the session ID in the JSON object, it is very easy to choose a session ID and get all of the relevant messages for it.
- Console - This very simple mechanism for logging makes development easier. The debugger doesn't need to be attached, it is fast, and you don't need to reload the log file constantly.
- Event Log - This log type should only be used for very important errors. Not only is this the most expensive log entry type, it can quickly overwhelm an IT admin with Event Viewer entries.
- Debug View - These log messages are only visible when a debugger or Debug Viewer is attached to the process.
Setting the environment variable ASPNETCORE_LOG_LEVEL to a number between 0 and 6 will result in decreasing levels of logging being printed to stdout. These logs will come from asp.net core internals. Setting HARMONY_CORE_LOG_LEVEL to a number between 0 and 6 will result in decreasing log levels for harmony core specific logs. When reporting diagnostic logs for a bug report, please set both of these environment variables to 0.
-
Tutorial 2: Building a Service from Scratch
- Creating a Basic Solution
- Enabling OData Support
- Configuring Self Hosting
- Entity Collection Endpoints
- API Documentation
- Single Entity Endpoints
- OData Query Support
- Alternate Key Endpoints
- Expanding Relations
- Postman Tests
- Supporting CRUD Operations
- Adding a Primary Key Factory
- Adding Create Endpoints
- Adding Upsert Endpoints
- Adding Patch Endpoints
- Adding Delete Endpoints
-
Harmony Core Code Generator
-
OData Aware Tools
-
Advanced Topics
- CLI Tool Customization
- Adapters
- API Versioning
- Authentication
- Authorization
- Collection Counts
- Customization File
- Custom Field Types
- Custom File Specs
- Custom Properties
- Customizing Generated Code
- Deploying to Linux
- Dynamic Call Protocol
- Environment Variables
- Field Security
- File I/O
- Improving AppSettings Processing
- Logging
- Optimistic Concurrency
- Multi-Tenancy
- Publishing in IIS
- Repeatable Unit Tests
- Stored Procedure Routing
- Suppressing OData Metadata
- Traditional Bridge
- Unit Testing
- EF Core Optimization
- Updating a Harmony Core Solution
- Updating to 3.1.90
- Creating a new Release
-
Background Information