Idea Quick Add Print log statement

Source: Internet
Author: User

Although the artifact is good, logger's plug-in is relatively difficult to find, online found an alternative is through the live template, quickly insert log print statements.

What we can do at the moment is:

1, declare the logger variable;

2, the method name and variable are printed at the method entrance.

Implementation 1:

Add the template group named logs to the live template and add live template,abbreviation to fill in your favorite abbreviations, I'm logf. Applicable context Select Statement&expression&declaration,template text input

Private Static final Org.slf4j.Logger LOG = Org.slf4j.LoggerFactory.getLogger ($CLASS _name$.  Class);

Implementation 2:

Add a live template, abbreviation, I porridge logp. Template text:

Log.debug ("$METHOD _name$:: $PLACE _holders$", $ARGUMENTS $);
Click Edit variable, several variables are defined as follows:

Place_holders = Groovyscript ("_1.collect {it + ' = [{}] '}.join (', ')", Methodparameters ())
ARGUMENTS = Groovyscript ("_1.collect {it}.join (', ')", Methodparameters ())
Method_name = MethodName ()

Applicable context selection (Java-> statment)

It's done.

Original link: http://artfulonline.blogspot.tw/2014/03/quick-logging-with-intellij-live.html

Idea Quick Add Print log statement

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.