TomCB TomCB - 1 month ago 24
Android Question

The logging tag can be at most 23 characters

Since update AS 1.1 Preview 2, I'm getting red lines under all my


Log.d(TAG, "message");

With message: "The logging tag can be at most 23 characters..".

I didn't update anything fundamentally, except Android Studio itself. Is this a bug?


No, it's not a bug. However, it seems your TAG's text length exceed 23 characters.

From Android Studio's Recent Changes on 1.1 Preview 2,

Checks that the tag passed to the logging calls, if its value can be resolved, is at most 23 characters long (as required by the Logging API.)

logging tag was 31

As shortly explained on the recent changes, it's due to how Log API doesn't allow tag that exceeds 23 characters.

From Log.isLoggable(),



IllegalArgumentException is thrown if the tag.length() > 23.

However, up until now, it's the only method that will throw the exception. Calling Log.d(), etc. won't throw it.

You can disable the lint checking by following Terence's answer. However, take note that Android may change the behavior of these methods and might throw the exception in the future.