
This blog post outlines the process of configuring a Phoenix LiveView application to use structured logging, incorporating AppSignal for log analysis, and distinguishing between framework and application logs. It covers the benefits of structured logging, configuring loggers, using logfmt, and setting up custom logger backends for enhanced application observability.
Main Points
Advantages of structured logging
Structured logging provides key advantages over unstructured logging by making data easier to search and analyze.
Use of logfmt format in development and production
The configuration for development and production uses the logfmt format, which offers a structured approach to logging messages.
Enhanced logging in production with AppSignal
Using AppSignal in production for structured logging enhances the ability to search, aggregate, and analyze log data at scale.
Custom backend for logging control
A custom logger backend helps in demarcating the necessary logging levels for framework and application logs, optimizing observability.
Insights
Benefits of structured logging
Structured logging breaks each piece of information into its own key/value pair, making it easier to search and analyze data.
Configuration for development
Configuring the logger to emit structured logs using LogfmtEx in the development environment.
Production logging with AppSignal
Incorporating the AppSignal logger in production to use logfmt for structured logging.
Framework vs. Application Logs
Differentiating between framework and application logs, and the benefit of setting framework logs to the FATAL level.
Custom Logger Backend
Creating a custom logger backend to control the logging level for Phoenix framework logs and application code logs.
Correlating Log Events and Telemetry
Using AppSignal to correlate log events with other telemetry data, providing a comprehensive observability posture.