Fork me on GitHub
#datomic
<
2016-05-20
>
limist14:05:57

Hi Datomicists, I'm running some tests that use Datomic (both in-memory, and queries against a persistent backend) and seeing a ton of DEBUG logging statements that clutter the test output. Is there a way to turn off those logging statements? I've tried adding the following code to the test namespace, but it has no effect:

(.setLevel (Logger/getLogger (str *ns*)) Level/WARN)

taylor.sando18:05:58

There should be a logback.xml in the root of your source folder. Here is what I have for mine:

taylor.sando18:05:02

<configuration scan="true">
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
      <encoder>
        <pattern>%d %-5p [%c{2}] %m%n</pattern>
      </encoder>
    </appender>

    <logger name="org.eclipse.jetty.server" level="WARN"/>
    <logger name="org.eclipse.jetty.util.log" level="WARN"/>
    <logger name="org.jboss.logging" level="WARN"/>
    <logger name="datomic" level="WARN"/>
    <logger name="io.pedestal" level="ERROR"/>

    <root level="info">
      <appender-ref ref="STDOUT" />
    </root>
</configuration>

stuartsierra19:05:20

@limist: Datomic uses SLF4J for logging, which forwards to whatever logging framework you want to use, which is controlled by the presence of SLF4J bindings in your project's dependencies. So you need to know what logging framework you have set up in your project, then configure it to reduce the logging level of the datomic.* loggers.

grav22:05:22

I’m using java.lang.Math/abs in a query, and I get a reflection warning, if I don’t define (defn abs [v] (java.lang.Math/abs v)). Then, my IDE tells me to type-hint v, so it ends up being (defn abs [^double v] (java.lang.Math/abs v)). Is this the way to go? Seems a bit boiler-platey 🙂

grav22:05:43

(query ends up being something like :where [(my.ns/abs ?v) ?abs-v])

grav22:05:21

Oh, and just using Math/abs works fine, save for the reflection warning