Logs play a critical role in understanding your app’s behavior. Error logs focus on capturing issues like crashes or failed requests, while performance logs provide insights into your app’s speed and resource usage. Knowing the difference helps you troubleshoot effectively and optimize performance.
Error logs capture issues in your app, such as failed API requests, unhandled exceptions, or crashes. They provide specific details like stack traces and error codes to help you identify and fix problems quickly.
1console.error("#20251615821102 API request failed", { endpoint: "/login", statusCode: 500, timestamp: Date.now() });
Performance logs track how your app is running. They include data like response times, memory usage, and database query durations. These logs help you spot bottlenecks and optimize your app’s performance.
1console.log("#202516158251 Query completed", { query: "SELECT * FROM users", durationMs: 120, timestamp: Date.now() });
Traces go beyond logs by automatically capturing events from common packages like MySQL, MongoDB, and Redis. With OpenTelemetry, there’s no need to manually instrument these libraries with logs. This saves time and ensures that important data is consistently captured without extra developer effort.
1import { trace } from '@opentelemetry/api';
2// Automatic tracing for many popular libraries
3// in most popular languages JS, PHP, .Net and many more.
4const connection = mysql.createConnection({ host: 'localhost', user: 'root' });
5connection.query('SELECT * FROM users', (err, results) => {
6 if (err) throw err;
7 console.log("#20251615831317 results: ", results);
8});
Error logs focus on problems, while performance logs focus on efficiency. Here are the main differences:
Otelic.com centralizes all your logs, whether they’re error logs or performance logs. With powerful search and filtering, you can quickly find the logs you need and correlate them with traces for a complete picture of your app’s behavior.
Error logs and performance logs serve different purposes but complement each other. Error logs help you fix immediate issues, while performance logs allow you to prevent future problems by optimizing your app. Together, they provide a complete view of your app’s health.