Logging COMO
When you use LOG4J2 as the logging API, it is possible to redirect COMOs to a standard logger.
Defining a Routing and a File Appender
By default, a routing appender is defined to have each agent logging to its own COMO file (standard file appender). The routing is defined by a thread context property matching the COMO name.
Set the following property as system property or JVM property at application start up:
- temenos.log.como=true
The above configuration generates the COMO logger and appender configuration within the TAFJTrace.properties file. When you use an existing deployment, make sure to delete the current TAFJTrace configuration file. The COMO appender and logger will be defined in the newly generated configuration file, i.e. when you use the properties configuration format.
appender.como.type = Routing
appender.como.name = como
appender.como.routes.type = Routes
appender.como.routes.pattern = $${ctx:COMO-NAME}
appender.como.routes.route1.type = Route
appender.como.routes.route1.file.type = File
appender.como.routes.route1.file.name = como-${ctx:COMO-NAME}
appender.como.routes.route1.file.fileName = ${sys:temenos.log.directory.como}/${ctx:COMO-NAME}
appender.como.routes.route1.file.layout.type = PatternLayout
appender.como.routes.route1.file.layout.pattern = %m%n
By default, COMOs log files are generated under <TAFJ_HOME>/log_T24/como. You can override this behavior by using the following property:
- temenos.log.directory.como=<PATH_TO_YOUR_COMO_LOG_FOLDER>
Combining a Socket, Routing and a File Appender
You can use the routing appender specified in the above section in conjunction with a socket appender to generate COMO files on a remote logging server. In this scenario, TAFJ application acts as a client of the logging server.
When you use the properties configuration format, make the following configurations to use the appender on the TAFJTrace configuration file:
#Socket client appender to be used to redirect como files to above remote routing appender
#Setup appropriate hostname and port to match the remote logging server
appender.como.type = Socket
appender.como.name = como
appender.como.host = 10.56.7.99
appender.como.port = 1212
appender.como.layout.type = SerializedLayout
appender.como.connectTimeoutMillis = 2000
appender.como.reconnectionDelayMillis = 10000
appender.como.protocol = TCP

On the server side, you can use the same routing appender that is defined above to receive the log events from the socket and route them to the appropriate file.
You can route the log events to the appropriate file using the following procedure.
- Deploy the following libraries on the logging server (LOG4J_HOME):
- log4j-core.jar
- log4j-api.jar
- jcommander-1.48.jar
The above libraries can be found in the TAFJ release under 3rdParty\logging\log4j2. - Copy the TAFJTrace configuration file (defining the COMO routing appender) on the server.
- Start the TCP socket server with appropriate classpath and parameters, i.e.
set LOG4J_HOME=C:\lo4j-socket-server-conf
set CLASSPATH=%LOG4J_HOME%\*
set JAVA_OPTS=-Dtemenos.log.directory=%LOG4J_HOME%\log -Dtemenos.log.directory.t24=%LOG4J_HOME%\t24-log -Dtemenos.log.directory.como=%LOG4J_HOME%\como-log
java %JAVA_OPTS% -cp %CLASSPATH% org.apache.logging.log4j.core.net.server.TcpSocketServer -c %LOG4J_HOME%\TAFJTrace.xml -p 1212 --classes java.util.Collections$UnmodifiableMap --classes java.util.HashMap
The TCP socket server gets started on the specified option -p port 1212. It defines the logger configuration coming from option -c TAFJTrace.xml.
Optionally, you can secure the communication by using SSL. For more information, see log4j2 documentation. In this case, the client appender configuration needs to be refined to define SSL parameters, i.e.
appender.como.ssl.type = SSL
appender.como.ssl.protocol = SSL
appender.como.ssl.keystore.type=KeyStore
appender.como.ssl.keystore.location=log4j2-keystore.jks
appender.como.ssl.keystore.password=changeme
appender.como.ssl.truststore.type=TrustStore
appender.como.ssl.truststore.location=trustore.jks
appender.como.ssl.truststore.password=changeme
In this topic