Only compile-time constants may be passed to log(String); use one of the formatting log methods with a constant format string if at all possible.
Some common fixes include:
String.format(), just unwrap that call: log(String.format("format %s", arg)) becomes log("format %s", arg).obj.toString(), remove the toString() so that you‘re calling log(Object) instead. It’s equivalent to log("%s", obj).@CompileTimeConstant to that parameter if possible.final to that variable or, if it's only used in this log statement, inline the constant value.log("foo " + bar + " baz"), write log("foo %s baz", bar).exception.toString() or exception.getMessage(), consider using withCause(exception).log() (with no separate log message) instead.If none of these work, the easiest workaround is to use "%s" as a format string, i.e. replace log(expr) with log("%s", expr).