Eclipse completion template

Someone gave me some  code for a logger auto-completion template that I should use in Eclipse.

After searching on Google and discovering where it is in STS 3.1.0 I added this simple template to auto-complete my logger to use slf4j:

${:import(org.slf4j.Logger, org.slf4j.LoggerFactory)}private static final Logger ${logger} = LoggerFactory.getLogger(${enclosing_type}.class);

This is configurable under the Window -> Preferences -> Java -> Editor -> Templates




I created a new template that I named logger, context is Java, a description (slf4j logging) and the pattern mentioned earlier.

Quite simple and so convenient that it will remove this bad habit of copying and pasting code with the wrong class name.


Published by


Java developper that loves photography and an excellent espresso

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s