The list of parameters from the command line can be obtained with the command:
> bin\SGCom.bat -h
SGCom uses command line parameters primarily to connect to the metering central and introduce itself. The following parameters are therefore mandatory:


  • -c <connectionString> – the address where the D2Connector.exe process listens for incoming JAPI connections. If the JAPI connection is encrypted, the path to the certificate file is after the semicolon.  If redundancy is used, the parameter can be specified multiple times to enumerate all connection points. Parameter value examples
    •  server.domain.sk:3120
    •  172.16.1.3:3121
    •  srvapp120v:3120;certificate.crt
  • -w <applicationName> – the name of the specific instance of SGCom with which it will introduce itself to the point of first connection.
  • -u <userName> – the name of the D2000 user account with which SGCom will attempt to log in.
  • -p <password> – password for the specified username. Logging in without a password is not supported.
  • -f <firstContact> – address of the first contact. The address consists of the D2000 Event name, the D2000 process, and optionally the D2000 event instance number. Examples:
    •  E.FirstContact@SELF.EVH
    •  E.FirstContact[1]@SGC.EVH

Other parameters can be used to tune some operational properties of the application:

  • -d <seconds> – the length of the time interval during which the logical device remains in the HardError state. By default, the interval is 300 seconds long.
  • -k <days> – the length of the time interval after which data is automatically deleted from DataStorage, even if it has not been transferred to the application. By default, the interval is 90 days long.
  • -n <seconds> – the length of time interval that SGCom waits for a new task to be entered before closing the connection to the logical device. By default, the interval is 10 seconds.
  • -r <retryLimit> – the maximum number of consecutive failed attempts to connect to a logical device after which the device is declared disconnected - a HardError condition is raised. By default, the attempt is repeated a maximum of 3 times.
  • -s <seconds> – the length of the protection time interval, when it is not possible to use the given communication line after the connection is canceled. By default, the interval is set to 20 seconds.
  • -t <threads> – the maximum number of threads in the ThreadPool (threads execute tasks on logical devices). By default, the limit is set to 512 threads.
  • -cdt <seconds> – the length of the time interval for which communication on the line is stopped if there is a repeated failure to establish a connection with the same device.
  • -hri<seconds> – HDLC reconnect interval - interval for HDLC frame repetition.


In addition to the parameters directly for SGCom, it is also possible to define parameters for the JVM Java Virtual Machine - the runtime environment in which SGCom is executed. They are specified in the JAVA_OPTS environment variable separated by spaces in the form:
set JAVA_OPTS=-Xmx1024m –Xms128m
The complete list of parameters is given by the JVM version used (see the relevant documentation), but in practice these were used:


  • -Djava.util.logging.config.file=<filename> – sets the path to the parameter file for creating the LOG (execution log).
  • -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n – allows connecting to the process via the java debugger on TCP port 8787.


Parameters for creating LOG


SGCom uses java.util.logging subsystem to create LOG. The parameters for this subsystem are defined in the "properties" file, which is referenced by the -Djava.util.logging.config.file parameter. In this file, it is possible to set the level of detail that will be recorded in the LOG for each subsystem of the application separately. The file also defines where the LOG should be stored.
Note: It is recommended that if multiple named instances of SGCom are launched from the same directory, a separate file with LOG parameters is defined for each instance.
The file structure is described in detail in the relevant documentation See documentation https://docs.oracle.com/javase/8/docs/api/java/util/logging/package-summary.html, here we will limit ourselves to the most used properties.


  • Definition of outputs - Output to file and console


handlers = java.util.logging.FileHandler, java.util.logging.ConsoleHandler


  • The message severity levels from the most severe are: OFF, SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST, ALL.
  • Defining the minimum severity level that the handler publishes


java.util.logging.FileHandler.level = ALL
java.util.logging.ConsoleHandler.level = FINE


  • Defining the name of the file to which the LOG is recorded. In the given example, the file is stored in the log/ directory and its name is of the form SGom(0).1.log. The number in parentheses is almost always 0, only used in case of a conflict (if two instances are trying to write to the same file). The number between the dots indicates the generation of the file - the program always creates a new file at startup and renames the previous ones by increasing their generation number.


java.util.logging.FileHandler.pattern = log/SGCom(%u).%g.log
java.util.logging.FileHandler.append = false


  • Limiting the size of the LOG file and the number of generations archived - in the example given, the limit is set to 8 MB and 6 generations.


java.util.logging.FileHandler.limit = 8388608
java.util.logging.FileHandler.count = 6


  • Defining the message logging level for individual subsystems of the application. Fully qualified identifiers of classes or their hierarchically superior units are used to name individual parts. The defined level applies to all hierarchically lower units if no own level of detail is defined for any subtree. In the given example:
    • The INFO severity level is set globally.
    • The ALL level applies to all classes included in sk.ipesoft.
    • The FINER level applies to the sk.ipesoft.sgcom.hdlc subsystem.


.level = INFO
sk.ipesoft.level = ALL
sk.ipesoft.sgcom.hdlc.level = FINER

In the case of debugging, the level can be defined separately for the following subsystems:


  • sk.ipesoft.d2000.d2japi.connector.Connector – monitoring of JAPI communication
  • sk.ipesoft.sgcom.config – configuration monitoring
  • sk.ipesoft.sgcom.dataStorage –monitoring of DataStorage
  • sk.ipesoft.sgcom.hdlc – monitoring of HDLC communication
  • sk.ipesoft.sgcom.iec21 – monitoring of IEC 62056-21 communication
  • sk.ipesoft.sgcom.serial – monitoring of serial communication
  • sk.ipesoft.sgcom.udp – monitoring of UDP-ADDAX communication
  • sk.ipesoft.sgcom.jdlms – monitoring of service library over DLMS (not directly DLMS communication)
  • sk.ipesoft.sgcom.production.TaskExecutorImpl –monitoring of TaskExecutor
  • sk.ipesoft.sgcom.production.ImmediateCommandListenerImpl – monitoring of immediate tasks
  • sk.ipesoft.sgcom.production.ProcessStateDispatcherImpl – monitoring of status notifications



Napíšte komentár