«

Configuring Logging

Transactor Logging

For version 1.0.6711 or lower, use the artifact com.datomic/datomic-pro

The Datomic transactor logs via logback. Datomic includes a logback configuration file at bin/logback.xml, which is set up by default to log to the directory specified by the log-dir transactor property (defaults to log/ within Datomic distribution). bin/logback.xml has several commented sections which can be uncommented to activate logging from various Datomic components.

Peer Logging

The Datomic peer library uses slf4j for logging, so Peers can be configured to output logs via a variety of standard Java logging libraries, including logback, java.util.logging and log4j by:

  • including the appropriate slf4j JAR on the classpath
  • (optionally) adding corresponding configuration files

The following sections show how to configure Peer logging in maven and in leiningen. If you do not configure logging for your project, the Datomic peer library will not log.

Peer Logging with logback

If you choose to use logback on the peer, you can use the transactor's bin/logback.xml file as a starting point for your configuration.

Maven

For maven, add the following to the dependencies section of your pom.xml, replacing DATOMIC_VERSION, as described above.

<dependency>
  <groupId>com.datomic</groupId>
  <artifactId>peer</artifactId>
  <version>DATOMIC_VERSION</version>
  <exclusions>
    <exclusion>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
    </exclusion>
    <exclusion>
     <groupId>org.slf4j</groupId>
     <artifactId>slf4j-nop</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>ch.qos.logback</groupId>
  <artifactId>logback-classic</artifactId>
  <version>1.0.1</version>
</dependency>

Leiningen

For leiningen, add the following to the dependencies section of your project.clj, replacing DATOMIC_VERSION, as described above.

[com.datomic/peer "DATOMIC_VERSION"
 :exclusions [org.slf4j/slf4j-nop org.slf4j/slf4j-log4j12]]
[ch.qos.logback/logback-classic "1.0.1"]

Peer Logging with java.util.logging

Maven

For maven, add the following to the dependencies section of your pom.xml, replacing DATOMIC_VERSION, as described above.

<dependency>
  <groupId>com.datomic</groupId>
  <artifactId>peer</artifactId>
  <version>DATOMIC_VERSION</version>
  <exclusions>
    <exclusion>
      <groupId>org.slf4j</groupId>
      <artifactId>jul-to-slf4j</artifactId>
    </exclusion>
    <exclusion>
     <groupId>org.slf4j</groupId>
     <artifactId>slf4j-nop</artifactId>
    </exclusion>
  <exclusions>
</dependency>
<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-jdk14</artifactId>
  <version>1.6.4</version>
</dependency>

Leiningen

For leiningen, add the following to the dependencies section of your project.clj, replacing DATOMIC_VERSION, as described above.

[com.datomic/peer "DATOMIC_VERSION"
 :exclusions [org.slf4j/jul-to-slf4j org.slf4j/slf4j-nop]]
[org.slf4j/slf4j-jdk14 "1.6.4"]

Peer Logging with log4j

Maven

For maven, add the following to the dependencies section of your pom.xml, replacing DATOMIC_VERSION, as described above.

<dependency>
  <groupId>com.datomic</groupId>
  <artifactId>peer</artifactId>
  <version>DATOMIC_VERSION</version>
  <exclusions>
    <exclusion>
     <groupId>org.slf4j</groupId>
     <artifactId>slf4j-nop</artifactId>
    </exclusion>
    <exclusion>
     <groupId>org.slf4j</groupId>
     <artifactId>log4j-over-slf4j</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-log4j12</artifactId>
  <version>1.6.4</version>
</dependency>

Leiningen

For leiningen, add the following to the dependencies section of your project.clj, replacing DATOMIC_VERSION, as described above.

[com.datomic/peer "DATOMIC_VERSION"
 :exclusions [org.slf4j/slf4j-nop org.slf4j/log4j-over-slf4j]]
[org.slf4j/slf4j-log4j12 "1.6.4"]