Member-only story
[Technology][App][Development] — Set the Right Logging Standards For your Applications
2 min readJul 11, 2024
“Optimize your application’s performance and troubleshooting capabilities through effective logging practices.”
1. Log Levels
- Ensure each log level is appropriately used:
- DEBUG for detailed information, typically of interest only when diagnosing problems.
- INFO for informational messages that highlight the progress of the application.
- WARN for potentially harmful situations.
- ERROR for error events that might still allow the application to continue running.
- FATAL for very severe error events that will presumably lead the application to abort.
Recommendations:
* Non-prod environments can have the debug level but production-only info or warn
2. Log Format
- Use a consistent log format (JSON) across all services. So that it can be easier to parse in services like Opensearch, Fluentbit and can be treated as an input for ingestion Pipelines for optimised logs.
- Include essential information: timestamp, log level, service name, thread ID, message, and context data (e.g., user ID, transaction ID).
- For microservices: ensure consistent logging practices across all services.
Recommendations:
* Don't use the…