• Skip to main content
  • Skip to primary sidebar
  • Home
  • About
  • Subscribe BMA
  • Contact Us!

Be My Aficionado

Inspire Affection

You are here: Home / Blogging / iTerm2 – Colorize The Tailed Logs In ITerm2 Terminal

iTerm2 – Colorize The Tailed Logs In ITerm2 Terminal3 min read

August 21, 2020 by Varun Shrivastava 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.

Share this:

  • Click to share on Facebook (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on Pinterest (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • More
  • Click to print (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to share on Pocket (Opens in new window)
  • Click to share on Telegram (Opens in new window)
  • Click to share on WhatsApp (Opens in new window)
  • Click to share on Skype (Opens in new window)
  • Click to email this to a friend (Opens in new window)

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

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Featured Posts

What Every Programmer Must know about Floating Point Numbers

August 23, 2017 By Varun Shrivastava Leave a Comment

Top 5 Best Flagship Smartphones Under 14000 INR April 2017

April 1, 2017 By Varun Shrivastava 2 Comments

Chicken 65 Hash Brown frankies

August 13, 2016 By Priyanka Yadav 1 Comment

My Mum Shouts at me for using Public Transportation Instead of my Car

May 7, 2017 By Varun Shrivastava 10 Comments

New Kindle Oasis: Best E-book Reader Device to Buy

October 25, 2017 By Varun Shrivastava Leave a Comment

Latest Posts

  • Study Abroad Destinations : Research and Review
  • Advent Of Code 2020 – Day 7 – Handy Haversacks
  • Advent Of Code 2020 – Day 6 – Custom Customs
  • Advent Of Code 2020 – Day 5 – Binary Boarding
  • Advent Of Code 2020 – Day 4 – Passport Processing

Categories

  • Blogging (101)
  • Cooking (11)
  • Fashion (7)
  • Finance & Money (12)
  • Programming (50)
  • Reviews (2)
  • Technology (22)
  • Travelling (4)
  • Tutorials (12)
  • Web Hosting (8)
  • Wordpress N SEO (19)

Follow us on facebook

Follow us on facebook

Grab the Deal Now!

Hostgator Starting @$3.95/mo

DigitalOcean Free Credits

Trending

Affordable Hosting amazon aoc-2020 bad luck believe in yourself best database earn money blogging education experience fashion finance Financial Freedom food friends goals google india indian cuisine indian education system java javascript life life changing love make money microservices motivation oops poor education system principles of microservices problem-solving programmer programming reality search engines seo SSD Hosting success technology tips top 5 web web developer wordpress

Copyright © 2021 · BeMyAficionado by Varun Shrivastava · WordPress

loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.