ThingWorx WebSocket-based Edge MicroServer (WS EMS) and Lua Script Resource (LSR) > Additional Configuration of WS EMS > Configuring the Logger Group
  
Configuring the Logger Group
Use the logger settings to configure a WS EMS to collect logging information. Here is an example of this group:
"logger": {
"level": "WARN",
"audit_target": "http://test.com",
"publish_directory":"/_tw_logs/",
"publish_level":"logger:level",
"max_file_storage":2000000,
"auto_flush":true,
"flush_chunk_size":16384,
"buffer_size":4096
},
The following table lists and describes the properties of the logger element :
Use
To Specify
level
The level of information that you want to include in the audit log file. The default level is WARN. Valid values include:
AUDIT
ERROR
WARN
INFO
DEBUG
TRACE
* 
When troubleshooting a problem, set the level to TRACE so that you can see all the activity. For production, set the level to ERROR if you want to see error messages.
audit_target
The path to the audit log file where audit events will be written. Alternatively, specify an HTTP address for the audit log file, where these events will be sent using a POST command.
Audit events are also written to the normal log destination. If no target is specified, no additional auditing takes place.
Valid values include:
file://path_to_file
http://hosted_location
publish_directory
A location for writing to log files those log events that meet or exceed the publish_level. If you do not specify a location for this property, this logging information is not written to log files. For example, "publish_directory":"/_tw_logs/",
* 
The LSR and WS EMS use the same naming scheme for log files. Specify a directory that is different from the one specified in the publish_directory property in the config.json file of the WS EMS.
publish_level
The level of information that you want to include in the alternate log files. The default value is logger:level, which tells WS EMS to use the same level as set in the levelproperty. Valid values are the same as for the level property:
AUDIT
ERROR
WARN
INFO
DEBUG
TRACE
max_file_storage
The maximum amount of space that log files can take up. Keep in mind that there are two concurrent log files. The maximum size of each individual log file is max_file_storage divided by 2. The default value is 2000000 bytes.
auto_flush
Whether WS EMS should flush every N bytes to the publish_directory. The N value is defined by flush_chunk_size.
WS EMS also flushes the buffer if a message has not been written to the log in the last second.
A setting of true for auto_flush forces WS EMS to flush every 16384 bytes by default.
flush_chunk_size
The number of bytes to write before flushing to disk. The default setting is 16KB..
* 
It is strongly recommended that you keep the default setting . You cannot effectively go lower than the value of your setting for the buffer_size property. Although no limits are enforced, it strongly recommended that you NOT use a value that is higher than the default value.
buffer_size
The maximum number of bytes that can be printed in a single logging message. The default setting is 4096 bytes.
* 
It is strongly recommended that you keep the default setting. Modify this value only if you have issues with logging speed or other performance issues, or if you are getting truncated messages in the log. If you expect to have very long messages that you want logged, increase this value.
As of version 5.4.0, the actual time is no longer used in the logs for the WS EMS and the Lua Script Resource (LSR). Instead, the logs use UTC timestamps.
As of version 5.3.4 of WS EMS, logging behavior changed, as follows:
The same format is used in log messages written to the console (text) as in log messages written to the persisted log files (formerly JSON). The log messages are no longer wrapped in a JSON object. The persisted log files are just text files. Their content will match what is printed out on the console.
You can specify certain limitations for logging. The property, buffer_size, allows you to specify the maximum number of bytes that can be printed in a single log message. In addition, the property, flush_chunk_size, allows you to specify a maximum of bytes to write before flushing to disk. If a message has not been written to the log in the last second, the buffer is flushed. These properties and their default values are shown in the config.json.documented configuration file in the WS EMS installation.
* 
Do not attempt to use config.json.documented to run your WS EMS. This file is intended as a reference. Instead, if you want to use all possible properties, use config.json.complete. Be sure to save the file as config.json before running WS EMS.