Skip to content

[Kaizen] improve logging configuration #977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/main/resources/conf/base.conf
Original file line number Diff line number Diff line change
Expand Up @@ -629,8 +629,11 @@ mantis {

akka {
loggers = ["akka.event.slf4j.Slf4jLogger"]
# Not using ${logging.logs-level} because it might be set to TRACE, which our version of Akka doesn't have.

# defaults to INFO to prevent any performance impact
loglevel = "INFO"
loglevel = ${?AKKA_LOGLEVEL}

logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
logger-startup-timeout = 30s
log-dead-letters-during-shutdown = off
Expand Down Expand Up @@ -688,5 +691,6 @@ logging {
logs-file = "mantis"

# Logs level
# NB. be aware you might want to adjust akka.loglevel as well if set to DEBUG
logs-level = "INFO"
}
4 changes: 3 additions & 1 deletion src/main/resources/logback.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<configuration>

<property name="stdoutEncoderPattern" value="%d [%logger{36}] - %msg%n" />
<property name="stdoutEncoderPattern" value="%d %-5level [%logger{36}] - %msg%n" />
<property name="fileEncoderPattern" value="%d [%thread] %-5level %logger{36} %X{akkaSource} - %msg%n" />

<!--read properties from application.conf-->
Expand Down Expand Up @@ -57,8 +57,10 @@
<appender-ref ref="METRICS" />
</root>

<!-- NB. be aware you might want to adjust akka.loglevel if you set any level to DEBUG -->
<logger name="io.netty" level="WARN"/>
<logger name="io.iohk.scalanet" level="INFO" />
<logger name="io.iohk.scalanet.discovery.ethereum.v4.DiscoveryService" level="WARN" />
<logger name="io.iohk.ethereum.blockchain.sync.SyncController" level="INFO" />
<logger name="io.iohk.ethereum.network.PeerActor" level="${LOGSLEVEL}" />
<logger name="io.iohk.ethereum.network.rlpx.RLPxConnectionHandler" level="${LOGSLEVEL}" />
Expand Down
3 changes: 3 additions & 0 deletions src/main/scala/io/iohk/ethereum/Mantis.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ package io.iohk.ethereum

import io.iohk.ethereum.nodebuilder.{StdNode, TestNode}
import io.iohk.ethereum.utils.{Config, Logger}
import java.util.logging.LogManager

object Mantis extends Logger {
def main(args: Array[String]): Unit = {
LogManager.getLogManager().reset(); // disable java.util.logging, ie. in legacy parts of jupnp

val node =
if (Config.testmode) {
log.info("Starting Mantis in test mode")
Expand Down