• Skip to main content
  • Skip to footer
  • Home
  • Become An Aficionado (Join Our Mailing List)
BMA

BeMyAficionado

Inspire Affection

Ad example

iTerm2 – Colorize The Tailed Logs In ITerm2 Terminal

August 21, 2020 by varunshrivastava Leave a Comment

Coloured logs are very helpful especially when you are going to deploy your application in production. The moment when the live traffic is shifted to your servers and you sit there eagerly watching the logs roll off in speed, only one thing in your mind that no warnings and errors should go by unnoticed. This is the best situation where colors play an important role.

In this article, I’m going to show you a way by which you can grep the individual lines from the logs using regex pattern match and change the color of that line instantaneously.

Let’s get started…

ITerm2 Triggers

In iTerm, a trigger is an action that is performed when text matching any regular regex pattern is received in the terminal session.

  • Triggers Documentation

So, you’ll be creating triggers for different regex patterns which are used in the logs. Usually, loggers in Java follow a pattern where for every error they print out “error” keyword in the logs and likewise “warn” for warning and “Fatal” if something terrible has happened 🙂

I will show you how to create triggers for the above keywords, you can modify the regex to match the keyword that is getting used in your application while printing logs.

iTerm2 - Go to preferences
Go to preferences

A dialog box will open.

Click on the “Profiles” tab and select “Advanced” at the right.

Navigate to triggers
Navigate to triggers

This is where you will find the option for editing the triggers. Click on the “edit” in the triggers section and create triggers as below.

Create triggers for error, warn and fatal
Create triggers for error, warn and fatal

I’ve created triggers for error, warn and fatal regex.

Once you have created the triggers, the next time your terminal shows up the word error, it will show that line as red.

Colored logs on the iTerm2 terminal
Colored logs on the iTerm2 terminal

Conclusion

This is a very cool feature offered by iTerm terminal. I use iTerm2 as my default terminal on mac. And always make sure you are using the coloured logs as it makes it so much easier to view and identify if something has gone wrong.

Related

Filed Under: Blogging, Tutorials Tagged With: colorize, colourful, fill colors, log-monitoring, logging, terminal

Footer

Become an Aficionado

BeMyAficionado is all about helping you connect, grow, and make an impact—one idea at a time.

Join our mailing list for exclusive how-to guides, insider stories, and free e-books.

Get first access to new posts, tools and resources we only share with subscribers.

Join 874 other subscribers

Recent

  • Is The Cosmos a Vast Computation?
  • Building Semantic Search for E-commerce Using Product Embeddings and OpenSearch
  • Leader Election with ZooKeeper: Simplifying Distributed Systems Management
  • AWS Serverless Event Driven Data Ingestion from Multiple and Diverse Sources
  • A Step-by-Step Guide to Deploy a Static Website with CloudFront and S3 Using CDK Behind A Custom Domain

Search

Tags

Affordable Hosting algorithms amazon aoc-2020 believe in yourself best database earn money blogging education elementary sorting algorithms experience fashion finance Financial Freedom food friends goals google india indian cuisine indian education system java life life changing love make money microservices motivation oops podcast poor education system principles of microservices problem-solving programmer programming python reality seo spring success success factor technology top 5 typescript wordpress

Copyright © 2025 · Be My Aficionado · Log in

Go to mobile version