I'd like to use log4jdbc-log4j2 to log JDBC calls. The documentation providers information how to use it with Log4j2 markers.
<logger name="log4jdbc.log4j2" level="info" additivity="false">
<MarkerFilter marker="LOG4JDBC_OTHER" onMatch="DENY" onMismatch="NEUTRAL"/>
<appender-ref ref="Console"/>
</logger>
Is there any way how to rewrite the above code to work with Logback?
UPDATE: I already tried to put a TurboFilter outside the logger directly inside the configuration element. It however doesn't change the log output.
<turboFilter class="ch.qos.logback.classic.turbo.MarkerFilter">
<Name>LOG4JDBC_LOGBACK_FILTER</Name>
<Marker>LOG4JDBC_OTHER</Marker>
<OnMatch>DENY</OnMatch>
</turboFilter>
I believe what you are looking for is called TurboFilters in Logback. See http://logback.qos.ch/manual/filters.html
Update: if I understand your question correctly, you have an application that uses the Log4j 2 API (or one of its dependencies does). You want to use Logback as the logger implementation. Now, the question is, how to route calls from the Log4j 2 API to the Logback implementation, ideally translating Log4j 2 Markers into SLF4J Markers?
Perhaps all you need to do is add the Log4j to SLF4J adapter (log4j-to-slf4j-2.x.jar).
Be careful: