DarVar
DarVar

Reputation: 18124

SLFJ4 bridge for the Maven logger

I'm writing a Maven 3.x plugin and want to log with SLF4J & Logback.

I found some SLF4J bindings for the Maven Logger:

However, these seem to be SLF4J bindings but I believe what I need is a bridge for the Maven Logger i.e. to bridge/route all Maven log statements to SLF4J and use LogBack binding with logback.xml config.

Upvotes: 3

Views: 1460

Answers (2)

sm4rk0
sm4rk0

Reputation: 483

You can use SLF4J directly from Maven plugin since Maven 3.1:

The standard Maven distribution, from Maven 3.1.0 onward, uses the SLF4J API for logging combined with the SLF4J Simple implementation. Future versions may use a more advanced implementation, but we chose to start simple.

No bridges, bindings, etc. needed.

Source: https://maven.apache.org/maven-logging.html

Upvotes: 4

yegor256
yegor256

Reputation: 105053

Your plugin should log through Log class. Logback is not required. Just forward all your logs to SLF4J and add jcabi-maven-slf4j dependency to the plugin. That's it.

Upvotes: 0

Related Questions