← Learning center

What is logging?

What is logging?

Your application's logs are like a diary, recording important events, actions, or messages as they occur. When you have access to an application's logs, you can better keep track of and understand what is going on behind the scenes of your application.

This article will explain the importance of logging and give you a basic understanding of the logging types, levels, and formats.

Why should I store my application's logs?

By storing your application's logs, you keep valuable historical information about your application's processes. This can be crucial for understanding the reasons behind specific behaviors in your application. For instance, if a batch of background jobs fail to execute, examining your logs could help you identify the cause.

Your application writes logs to log files, which can be challenging to query; so it can be beneficial to use a log management tool that allows you to store, read, and query logs in real-time.

Logs are typically written to the console in stdout when you run an application in the development environment or standard output format. You can configure your application to write logs to specific files.

Generally speaking, logs are relatively easy to understand, but to properly manage and utilize your logs, it's important to understand:

With the information from your application logs, you can better understand and re-create scenarios and avoid lengthy, expensive debugging sessions that sometimes yield no results.

Log severity levels

There are various levels of logging severity. Note that not all logging tools will support all levels of logging.

Log TypeDescription
DebugDetailed information used for development and debugging.
InfoGeneral information about the application's execution.
WarnIndicates potential issues or conditions that require attention.
ErrorCaptures errors and failures that occur during execution.
FatalIndicates severe errors that result in application termination.
TraceOptional detailed logging for tracking specific code execution.

Debug and trace log levels are used in specific scenarios during development and debugging processes:

  • Debug logs are helpful when you need to investigate and troubleshoot specific issues in your code and understand your application's behavior in detail, for example, when re-creating a specific error scenario locally.
  • Trace logs provide a detailed account of each action and operation within your application, allowing you to follow its execution flow closely. They are especially useful in complex systems or when you need to understand how different components and functions interact.

Log types

Three types of logs are common across most programming languages and frameworks, including Ruby on Rails, Elixir, and Node.js. Each log type provides useful insights for specific tasks:

Log TypeDescriptionUseful For
Application LogsLogs that record events and messages specific to an application.Debugging and monitoring application behavior
Error LogsLogs that capture exceptions, errors, and issues encountered in a system.Identifying and fixing application errors, debugging
System LogsLogs that capture system-level events, activities, and messages.Server administration, troubleshooting

The type of logs you need to investigate may vary depending on the type of problem you are trying to fix, for example:

  • Application Logs: When investigating unexpected behavior in an application, such as when adding an item to a shopping cart results in the wrong quantity of the item being added.
  • Error Logs: When investigating an application's errors and exceptions, e.g., when an API returns 5xx codes to requests.
  • System Logs: In scenarios involving server administration and troubleshooting, for example, if you are experiencing server slowdowns or encounter server-related errors.

Log formats

Logs can be formatted in various ways. You may have to configure your logs to output in a specific format when sending them to a logging service.

Common log formats are:

  • JSON
  • Logfmt
  • NDJSON
  • Plaintext
  • Syslog (RFC 5424)

How your log messages will look will vary depending on your chosen output format:

Log FormatLog Message
JSON{"timestamp": "2022-06-02T04:17:25.783Z", "severity": "warn", "message": "message"}
Logfmttimestamp="2022-06-02T04:17:25.783Z" severity="warn" message="message"
NDJSON{"timestamp": "2022-06-02T04:17:25.783Z", "severity": "warn", "message": "message"}
Plaintext2022-06-02T04:17:25.783Z [warn] message
Syslog (RFC 5424)<134>1 2022-06-02T04:17:25.783Z - - - [warn] message

AppSignal Logging

AppSignal Logging is a powerful log management solution that puts you in charge of your logs with amazing developer-friendly features such as:

  • Seamless Log Ingestion: Support for popular platforms such as AWS Kinesis/CloudWatch, Heroku, and more. We also support ingesting logs directly from your code via our Elixir, Node.js, and Ruby integrations.
  • Log Filtering: Easily search, filter, and organize your logs. You can filter logs by source, severity, hostname, group, and message.
  • Log Severity Visualization: Visualize log severity over time using our interactive charts, allowing you to detect patterns in logging volume and severity.
  • Custom Log Views: Personalize your log views by creating custom filters, making it easy to focus on specific issues and debug efficiently.

We've designed our logging feature to help you get the most out of your logs, in combination with your application's monitoring data. Gain a deeper understanding of your application's behavior without needing to become an expert in DevOps.

Further reading

If you've found this article interesting, you can learn more about logging on our blog:

Start logging with AppSignal

You can start managing your application's logs in as little as five minutes with AppSignal. If you are not yet a customer, sign up for a free trial. If you get stuck or have a question about AppSignal, our dev-to-dev support is always on hand to help!

You can learn more about AppSignal Logging on our Log management page.

Start your free trial

Don’t let the bad bugs bite. Try AppSignal for free.

AppSignal offers a 30-day free trial, no credit card is required. All features are available in all plans. Start monitoring your application in just a few clicks!