I created a fix for this issue: https://github.com/qos-ch/logback/pull/515
The loop detection is inspired by the Throwable.printStackTrace implementation.