DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • Node.js: Architectural Gems and Best Practices for Developers to Excel
  • Navigating Progressive Delivery: Feature Flag Debugging Common Challenges and Effective Resolution
  • Keep Your Application Secrets Secret
  • Dynatrace Perform: Day Two

Trending

  • Navigating the Skies
  • Auto-Scaling DynamoDB Streams Applications on Kubernetes
  • How To Verify Database Connection From a Spring Boot Application
  • Implementing Stronger RBAC and Multitenancy in Kubernetes Using Istio

5 Very Real Logging Struggles

Manoj Chaudhary provides the top five logging struggles that most organizations face on a daily basis, providing solutions as well.

Manoj Chaudhardy user avatar by
Manoj Chaudhardy
·
Nov. 13, 15 · Analysis
Like (4)
Save
Tweet
Share
5.92K Views

Join the DZone community and get the full member experience.

Join For Free

Logs have been around almost as long as computers and are always at the core of applications. As SaaS, big data, and IoT applications have grown, so have their logs.

People are solving big problems and making key product decisions based on logs that are often a complete mess. Even though logging is an important part of what every developer does, it’s not a top-of-mind topic when people are talking about development best practices. In this post, I’m going to share some very real logging struggles that illustrate why many developers need to change how they log application events.

Struggle #1: Logs Serve More People Than Developers

Most developers create logs with the sole intent of debugging their own code. But once that code goes into production, multiple people in the organization are depending on those same logs:

  • Support teams need logs to understand the root causes of customer problems.
  • Ops teams need logs to detect issues with production environments.
  • Other developers may need logs to spot interdependencies between parts of the application.
  • Product managers often use logs to understand feature usage and make product decisions.

Each of these different personas look at log data with a different mindset, but the logs were created based on the developer’s thought process. This can cause big struggles for non-developers who need to extract insights and information from these logs to get their work done.

Solution:

Treat the requirements of log users as another product or end-user requirement. It is important for each developer to understand all of the personas and their use cases so his or her applications emit logs that are actually helpful in giving people the insights they want on a daily basis.

Struggle #2: TL;DR

Logs are supposed to help you understand: the behavior of your application, issues with your application, application usage, and much more. But if you ask most non-developers, they will say logs are “TL;DR.” In other words, not worth investing the time to read and digest them. They are right.

Most logs are ugly. Most logs are cryptic because the developers who wrote them were much closer to them than the people who are ultimately using them. If you add these two factors together, you get an incredibly painful log reading experience. Yet way too many developers and Ops people resort to manual log scanning when they have a problem to solve.

Solution:

The key is to create logs that are machine readable so they can reveal what matters to you rather than manually scanning the logs and trying interpret it.

Struggle #3: Logs Are Tough to Change

Logs are part of your code, so any changes go through the same build-test-deploy cycle that you use for your functionality. The problem is, many of the personas who use log data don’t get a chance to express their requirements or needs until long after the code has shipped and when customers are actually using the functionality. It’s painful to have to rebuild logs after the fact, especially if you’re not planning for it!

Solution:

Capture requirements or user stories for logging just like you would for your core functionality. At the same time, recognize that logging can be an iterative process. Its usage is only beginning when the code ships. Your logging system should be part of your design discussions and documentation. The key is to treat logging as a feature rather than something that can be taken care of later as needed.

Struggle #4: How Much Logging Is Too Much?

A lot of developers worry about the performance impact of logging. They shouldn’t. As my colleague Jon Gifford recently showed, the hit that your application will take from logging is miniscule compared to the benefits of understanding what’s happening with your application.

Developers also worry that if they add too much data or too many metrics to their logs, they will have a hard time reading those logs. Of course, this is only a problem if you’re relying on manual scanning to find relevant data points. Log management solutions like Loggly will chew through the most verbose of logs and pull out the nuggets of insight.

Solution:

When you create logs, think about machines as your readers. Don’t worry about logging too much. The last thing you want to do is say, “I should have logged that” after the fact, when your application has been down for an hour or throwing random errors.  

Struggle #5: In What Format Should I Log?

When developers are struggling with logging formats, readability is once again at the forefront of their minds. Structured formats like JSON can be hard for people to read. But are people the most important readers?

Solution:

Use a structured format like JSON. It’s much easier for machines to read and as a result, much easier for people to gain insight. You’ll end up with more analysis and better analysis.

Conquer Your Logging Struggles

The moral of the story is this: Always log as much as you can, and always log in the best format for machine processing.

Too often, logging struggles manifest themselves when it’s too late, after your team has been burned out solving a tough problem. By changing your mindset now, you’ll be in a position to save your team from tiresome logging struggles so they can focus on real problem solving.  

Want to Learn More?

Check out this great ebook, the Pragmatic Logging Handbook, written by my smart colleague Jon Gifford. If you’re running a SaaS application, you may also enjoy my blog post series on Building SaaS for Scale.

Ready to put your new knowledge into practice? Get started with a Loggly free trial!

application dev

Published at DZone with permission of Manoj Chaudhardy, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Node.js: Architectural Gems and Best Practices for Developers to Excel
  • Navigating Progressive Delivery: Feature Flag Debugging Common Challenges and Effective Resolution
  • Keep Your Application Secrets Secret
  • Dynatrace Perform: Day Two

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: