How to change logging level for JanusGraph / Cassandra running inside Java FX Application?

Viewed 374

I am running JanusGraph on Cassandra and ElasticSearch. When I am running the application in IntelliJ, JanusGraph produces a large amount of DEBUG output. How can I change the logging output to only show ERROR messages?

This is described @ https://docs.janusgraph.org/basics/common-questions/ under "Debug-level Logging Slows Execution" section, but it does not actually say how to downgrade the logging output level.

My cassandra.properties file for Cassandra is:

gremlin.graph=org.janusgraph.core.JanusGraphFactory
storage.backend=cql
storage.hostname=127.0.0.1
storage.cql.keyspace=janusgraph
cache.db-cache=true
cache.db-cache-clean-wait = 20
cache.db-cache-time = 180000
cache.db-cache-size = 0.25
index.search.backend=elasticsearch
index.search.hostname=127.0.0.1

My logbook.xml file is:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <layout class="ch.qos.logback.classic.PatternLayout">
      <Pattern>
        %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
      </Pattern>
    </layout>
  </appender>

  <root level="warn">
    <appender-ref ref="STDOUT" />
  </root>


  <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
    <!-- encoders are assigned the type
         ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
    <encoder>
      <pattern>%d{HH:mm:ss} %-5level %logger - %msg%n</pattern>
    </encoder>
  </appender>
  <logger name="o.j.g.t.vertexcache.GuavaVertexCache" level="ERROR"/>
  <logger name="org.apache.cassandra.gms.FailureDetector" level="ERROR"/>
  <root level="ERROR">
    <appender-ref ref="CONSOLE" />
  </root>
</configuration>

My pom.xml file is:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.abc</groupId>
    <artifactId>abc</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>14</maven.compiler.source>
        <maven.compiler.target>14</maven.compiler.target>
        <example.main.class>com.abc.123</example.main.class>
        <example.config>${project.basedir}/conf/cassandra.properties</example.config>
        <logback.config>${project.basedir}/conf/logback.xml</logback.config>
    </properties>

    <dependencies>
        <!-- Skipped -->
    </dependencies>


    <build>
        <plugins>
            <!-- Skipped -->
        </plugins>
    </build>
</project>
1 Answers

I set the debug log to ERROR with below configuration.

<configuration scan="true">


    <appender name="STDOUT"
        class="ch.qos.logback.core.ConsoleAppender">
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>ERROR</level>
        </filter>
        <encoder>
            <pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern>
        </encoder>
    </appender>


    <root level="ERROR">
        <appender-ref ref="STDOUT" />
    </root>

</configuration> 

Reference link.

Related