Skip to content
Peter Taoussanis edited this page Aug 30, 2024 · 1 revision

tools.logging

tools.logging can use Timbre as its logging implementation (backend). This'll let tools.logging calls trigger Timbre logging calls.

To do this:

  1. Ensure that you have the tools.logging dependency, and
  2. Require the taoensso.timbre.tools.logging namespace
  3. Call taoensso.timbre.tools.logging/use-timbre

Java logging

SLF4Jv2 can use Timbre as its logging backend. This'll let SLF4J logging calls trigger Timbre logging calls.

To do this:

  1. Ensure that you have the SLF4J dependency ( v2+ only), and
  2. Ensure that you have the Timbre SLF4J backend dependency

When com.taoensso/timbre-slf4j (2) is on your classpath AND no other SLF4J backends are, SLF4J will automatically direct all its logging calls to Timbre.

Timbre needs SLF4J API version 2 or newer. If you're seeing Failed to load class "org.slf4j.impl.StaticLoggerBinder" it could be that your project is importing the older v1 API, check with lein deps :tree or equivalent.

For other (non-SLF4J) logging like Log4j, java.util.logging (JUL), and Apache Commons Logging (JCL), use an appropriate SLF4J bridge and the normal SLF4J config as above.

In this case logging will be forwarded:

  1. From Log4j/JUL/JCL/etc. to SLF4J, and
  2. From SLF4J to Timbre
Clone this wiki locally