Logging
The eMessage Connector uses the Logback logging framework to manage what it logs and how its logs roll over to prevent the logs from filling up the file system. The default logging configuration writes logs with a log level of INFO to the installation sub-directory called logs. The Connector logs to both the console (standard output) and a rolling appender, based on time and a maximum size.
All of the defaults can be changed and additional appenders created by modifying the logback.xml file that is distributed with the Connector. For complete information on how to configure the appenders and encoders for the logging configuration, refer to the chapter about Logback configuration on the Logback website: http://logback.qos.ch/manual/configuration.html and the examples provided in this section.
* 
It is important to keep in mind that logging is initialized only when the Connector starts up. Any changes that you make to the logger configuration take effect the next time that the Connector starts up.
Types of Logs
There are two types of logs for the Connector:
Operational — Contains messages that describe the state of the application or changes in the state of the application. It is intended for system administrators or any person interested in the general health of the system. For example:
The application has started.
The application failed to start due to a mis-configuration.
An external system that was previously unavailable is available again.
The configuration has been updated.
A periodic process has run.
A bounded resource has exhausted all of its resources:
Functional — Contains messages that describe the lower-level details about what the individual application components are doing to accomplish their purpose (or function), including the context. In general, functional logs are more useful for debugging an application when problems arise. For example
Sending an HTTP request to service endpoint (a write property service call, for example): endpoint=http://localhost:8720/some-service.
Database selection for user information failed: database=drm_data-source, userId=213801478. [With exception stacktrace]
Stack traces
To help differentiate the operational and functional logs, all operational logs are tagged with the "operational" marker. This tagging allows you to do something special for operational logs. The example in the next section shows how.
Separating Operational and Functional Logging in the logback.xml File
By default, all logging information is combined into one file. To separate the operational logs from the functional logs, add the following appender information to the logback.xml file
<appender name="OPSLOG" class="ch.qos.logback.core.FileAppender">
<file>cxserver-ops.log</file>
<append>true</append>
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
<marker>operational</marker>
</evaluator>
<OnMismatch>DENY</OnMismatch>
</filter>
<encoder>
<pattern>$d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
In addition, to send operational logs exclusively to a separate file, you need to exclude them from the functional log by adding the following clause inside the LOGS appender:
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
<marker>operational</marker>
</evaluator>
<OnMatch>DENY</OnMatch>
</filter>
In addition, add an appender-ref for the operational log (OPSLOG):
<root level="info">
<appender-ref ref="LOG" />
<appender-ref ref="OPSLOG" />
</root>
The first appender-ref specifies the functional log. The second one is for the operational log.
Resolving a Reference in the Configuration File to the Metrics Logger
The reference to the metrics logger in the configuration file for the eMessage Connector is resolved in the logback.xml file by using the following appender:
<appender name="METRICS" class="ch.qos.logback.core.FileAppender">
<file>metrics.log</file>
<append>false</append>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>

<logger name="metrics" additivity="false">
<appender-ref ref="METRICS" />
</logger
Was this helpful?