Skip to content

Commit 6dce8bb

Browse files
fix maru clients log names (#463)
* fix maru clients log names * fix logger
1 parent 0f6dc85 commit 6dce8bb

File tree

2 files changed

+18
-23
lines changed

2 files changed

+18
-23
lines changed

app/src/main/kotlin/maru/app/MaruAppFactory.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,10 @@ class MaruAppFactory {
326326
web3j =
327327
createWeb3jHttpClient(
328328
rpcUrl = lineaConfig.l1EthApiEndpoint.endpoint.toString(),
329-
log = LogManager.getLogger("clients.l1.linea"),
329+
log = LogManager.getLogger("maru.clients.l1.linea"),
330330
),
331331
contractAddress = lineaConfig.contractAddress.encodeHex(),
332-
log = LogManager.getLogger("clients.l1.linea"),
332+
log = LogManager.getLogger("maru.clients.l1.linea"),
333333
)
334334
val l2Endpoint = lineaConfig.l2EthApiEndpoint
335335
LineaFinalizationProvider(
@@ -339,7 +339,7 @@ class MaruAppFactory {
339339
rpcUrl =
340340
l2Endpoint.endpoint
341341
.toString(),
342-
log = LogManager.getLogger("clients.l2.eth.el"),
342+
log = LogManager.getLogger("maru.clients.l2.eth.el"),
343343
requestRetryConfig = l2Endpoint.requestRetries,
344344
vertx = vertx,
345345
stopRetriesOnErrorPredicate = { true },

jvm-libs/test-utils/src/main/kotlin/maru/test/cluster/Configuration.kt

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99
package maru.test.cluster
1010

1111
import org.apache.logging.log4j.Level
12-
import org.apache.logging.log4j.LogManager
13-
import org.apache.logging.log4j.core.LoggerContext
14-
import org.apache.logging.log4j.core.appender.ConsoleAppender
12+
import org.apache.logging.log4j.core.config.Configurator
1513
import org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilderFactory
14+
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration
1615

1716
fun configureLoggers(
1817
pattern: String = "%d{yyyy-MM-dd HH:mm:ss} [%level] - %msg | %logger{36}%n",
@@ -31,18 +30,17 @@ fun configureLoggers(
3130
) {
3231
val builder = ConfigurationBuilderFactory.newConfigurationBuilder()
3332

34-
// Create pattern layout
33+
// Create console appender with custom pattern
34+
val appenderBuilder =
35+
builder
36+
.newAppender("Console", "CONSOLE")
37+
.addAttribute("target", "SYSTEM_OUT")
38+
3539
val layoutBuilder =
3640
builder
3741
.newLayout("PatternLayout")
3842
.addAttribute("pattern", pattern)
39-
40-
// Create console appender
41-
val appenderBuilder =
42-
builder
43-
.newAppender("Console", "CONSOLE")
44-
.addAttribute("target", ConsoleAppender.Target.SYSTEM_OUT)
45-
.add(layoutBuilder)
43+
appenderBuilder.add(layoutBuilder)
4644

4745
builder.add(appenderBuilder)
4846

@@ -51,21 +49,18 @@ fun configureLoggers(
5149
builder
5250
.newRootLogger(rootLevel)
5351
.add(builder.newAppenderRef("Console"))
54-
5552
builder.add(rootLoggerBuilder)
5653

57-
// Add specific logger configurations
54+
// Configure specific loggers
5855
logLevels.forEach { (loggerName, level) ->
59-
builder.add(
56+
val loggerBuilder =
6057
builder
6158
.newLogger(loggerName, level)
59+
.addAttribute("additivity", false)
6260
.add(builder.newAppenderRef("Console"))
63-
.addAttribute("additivity", false),
64-
)
61+
builder.add(loggerBuilder)
6562
}
6663

67-
// Apply configuration
68-
val ctx = LogManager.getContext(false) as LoggerContext
69-
ctx.configuration = builder.build()
70-
ctx.updateLoggers()
64+
val configuration: BuiltConfiguration = builder.build()
65+
Configurator.initialize(configuration)
7166
}

0 commit comments

Comments
 (0)