0

I have a new project with Akka-http 2.4.2 and com.websudos.phantom 1.22.0
All works fine but I don't know how to change the log level to INFO so the DEBUG logs of phantom like:

17:00:51.792 [cluster1-nio-worker-0] DEBUG com.datastax.driver.core.Connection - Connection[/192.168.120.24:9042-1, inFlight=0, closed=false] was inactive for 30 seconds, sending heartbeat 17:00:51.931

[cluster1-nio-worker-0] DEBUG com.datastax.driver.core.Connection - Connection[/192.168.120.24:9042-1, inFlight=0, closed=false] heartbeat query succeeded

and

17:07:27.387 [system-akka.actor.default-dispatcher-10] DEBUG com.websudos.phantom - Executing query: SELECT * FROM table1 WHERE user = '1_1003600499' LIMIT 1;

are ignore for console.

Can I put this configuration in the file application.conf?. If so, how?

RESOLUTION:
As @flavian answered (and with little modification)
1) Create a file logback.xml in the resources folder
2) Copy and pase the following configuration

<configuration scan="false">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
        <level>INFO</level>
    </filter>
    <encoder>
        <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -oijojj %msg%n</pattern>
    </encoder>
</appender>

<logger name="com.websudos.phantom" level="WARNING"/>

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

</configuration>

This will make the logs only show INFO level onwards on the console

George C
  • 1,168
  • 13
  • 30

1 Answers1

0

Phantom offers a SLF4J/Logback compatible API, meaning all you need to do is to provide the right logback.xml configuration in the resources folder of the module you want to configure.

Have a look at this.

<configuration scan="false">
  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
    </encoder>
  </appender>

  <logger name="com.websudos.phantom" level="WARNING">
  </logger>

  <root level="INFO">
    <appender-ref ref="STDOUT" />
  </root>
</configuration>
flavian
  • 28,161
  • 11
  • 65
  • 105
  • thank you so much!! Now with your help the heartbeat log doesn 't show more. The "system-akka.actor.default-dispatcher" event log still is showing(the last log example), I think that may be I have to configure akka actors logging level, I'm not sure (still investigating) – George C Mar 09 '16 at 12:27
  • Solution found!, I don' t know if is the cleanest one, please comment if a better one can be done. Again thanks @flavian – George C Mar 09 '16 at 13:11