How to apply System.out.printf(...) inspection hint to a custom function



IntelliJ will offer fantastic inspection hints for the following:

System.out.printf("%.2f - %s", 10f, 5);

Which will indicate that the format string does not match the type of its arguments. I love this.

I have a BaseLogger class that I use throughout many applications which takes a log4j logger and decorates it with functions like the following:

protected void info(String format, Object... args) {, args));

protected void debug(String format, Object... args) {
    log.debug(String.format(format, args));

These functions allow me to log via string format with varargs.

The only problem is, I have no way of visually knowing when I have not fulfilled the format contract like I do with System.out.printf(...).

How can I get IntelliJ to use the same validation on my custom BaseLogger methods?



This is not really an answer but I think I obtained the same effect with minimal change.

Here is what I did:

  1. Migrated from JCL -> slf4j
  2. Changed my parameterized logging from printf format (%s %d) to the slf4j format (using {} parameter markers)
    1. This was much easier than I had anticipated thanks to IntelliJ's awesome search/replace and structural search/replace
  3. Simplified my BaseLogger so that all it provided was a protected Logging object
  4. Installed the Log Support plugin by Juergen Kellerer:

That's it. Now I get what I wanted: Highlighting missing arguments when logging with parameters!


It seems that ReSharper supports defining custom string formatting methods: http://

But I can't find similar support in Intellij IDEA.


I am still very interested in this


Have you checked Lombok plugin? It should be helpful for logging: . Laos please check this thread: .


Please sign in to leave a comment.