Used SiftingAppender like in official example and it works: http://logback.qos.ch/manual/appenders.html#SiftingAppender
<configuration>
<appender name="FILE" class="ch.qos.logback.classic.sift.SiftingAppender">
<!-- in the absence of the class attribute, it is assumed that the
desired discriminator type is
ch.qos.logback.classic.sift.MDCBasedDiscriminator -->
<discriminator>
<key>myDefinedName</key>
<defaultValue>unknown</defaultValue>
</discriminator>
<sift>
<appender name="FILE-${myDefinedName}" class="ch.qos.logback.core.FileAppender">
<file>${myDefinedName}.log</file>
<append>false</append>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%d [%thread] %level %mdc %logger{35} - %msg%n</pattern>
</layout>
</appender>
</sift>
</appender>
<root level="WARN">
<appender-ref ref="FILE" />
</root>
</configuration>
if that MDC value is null, then defaultValue is used as the discriminating value for log name.