@@ -6,7 +6,8 @@ import picocli.CommandLine.Model.CommandSpec
6
6
import java.util.*
7
7
import java.util.concurrent.Callable
8
8
import kotlin.system.exitProcess
9
-
9
+ import org.apache.logging.log4j.core.config.Configurator
10
+ import org.slf4j.LoggerFactory
10
11
11
12
data class EnvParameter (
12
13
var symbol : String ,
@@ -50,6 +51,10 @@ class Checksum : Callable<Int> {
50
51
private lateinit var modbusServer: ModbusServer
51
52
private lateinit var environmentParameters: List <EnvParameter >
52
53
54
+ companion object {
55
+ val logger = LoggerFactory .getLogger(" main" )
56
+ }
57
+
53
58
private fun processEnvironmentParameters (parameters : MutableList <String ?>? ): List <EnvParameter > {
54
59
val envParameter = mutableListOf<EnvParameter >()
55
60
parameters?.forEach { param ->
@@ -66,17 +71,18 @@ class Checksum : Callable<Int> {
66
71
}
67
72
68
73
override fun call (): Int {
74
+ Configurator .initialize(null , " log4j2.xml" )
69
75
val mainCoroutineScope = CoroutineScope (Dispatchers .Default )
70
76
val configuration = ConfigurationParser ()
71
77
72
78
if (simulationRandomValues && file.isNotEmpty()){
73
- println (" -f and -sr cannot be mixed, one of the simulations must be chosen" )
79
+ logger.error (" -f and -sr cannot be mixed, one of the simulations must be chosen" )
74
80
return - 1
75
81
}
76
82
77
83
environmentParameters = processEnvironmentParameters(parameters)
78
84
if (environmentParameters.isNotEmpty()){
79
- println (" environment parameters: ${environmentParameters.toString()} " )
85
+ logger.warn (" environment parameters: ${environmentParameters.toString()} " )
80
86
}
81
87
82
88
// val fileContents = Files.readAllBytes(file.toPath())
0 commit comments