IntelliJ Live Template for console.log That Will Improve Your Daily Development Life

A handy shortcut for one of our most common tasks

Photo by Blake Connally on Unsplash

We’ve all been there. Our code is not behaving like we hoped it would and it’s not obvious why. The easiest and fastest way to get a clue for what’s going on is to simply put a print statement in the code. It’s not nice; we should use a proper debugger, but we do it anyway.

The following live template will add the console.log(‘’) statement to your code; automatically insert the class name, function name, and line number in the log message; offer code completion for the message you want to log; and place the cursor where you need it.

According to Larry Wall, the original author of the Perl programming language, one of the three great virtues of a programmer is laziness.

So let’s automate the boring stuff!

There’s a video showing the setup and usage of the live template further down. You can pause and skip parts of the video or just follow the instructions below.