Logger Filter

The purpose of this document is to provide an overview on how to setup Logger Filter in Etch. As the name suggests, Logger filter logs etch messages and events into a file.
Logger Filter can be enabled for Client, Listener or both.

Logger Filter Parameters

Logger.filePath - This parameter is used to define the location and name of the logFile. For example Logger.filePath=C:\test\log\server.txt, in this case etch messages and
events will be logged to file C:\test\log\server.txt. If a user then does define this parameter, then etch will use a default file for logging (Log.txt)

How to enable Logger Filter

Change uri to one of the following

  • string uri ="tcp://localhost:4006?filter=Logger&Logger.filePath=C:\test\log\server.txt";

Logs will be written to C:\test\log\server.txt

  • string uri = "tcp://localhost:4006?filter=Logger

In this case, logs will be written to default file Log.txt

Snippet of Log File

16:11:49.593: Incoming: Messagizer : Packetizer / TcpConnection(up, 127.0.0.1:4006, 127.0.0.1:3161)
16:11:49.609: Incoming: etch.examples.example.Example.hello(-1567573670): {msg(769750364)=I am printing message 0, _messageId(1661383784)=633512167095000000}
16:11:49.609: Outgoing: etch.examples.example.Example._result_hello(92919767): {_inReplyTo(-307705434)=633512167095000000, result(-2130379326)=0}
16:11:49.625: Incoming: etch.examples.example.Example.hello(-1567573670): {msg(769750364)=I am printing message 1, _messageId(1661383784)=633512167095000037}
16:11:49.625: Outgoing: etch.examples.example.Example._result_hello(92919767): {_inReplyTo(-307705434)=633512167095000037, result(-2130379326)=0}
16:11:49.625: Incoming: etch.examples.example.Example.hello(-1567573670): {msg(769750364)=I am printing message 2, _messageId(1661383784)=633512167095000074}
16:11:49.625: Outgoing: etch.examples.example.Example._result_hello(92919767): {_inReplyTo(-307705434)=633512167095000074, result(-2130379326)=0}
16:11:49.625: Incoming: etch.examples.example.Example.hello(-1567573670): {msg(769750364)=I am printing message 3, _messageId(1661383784)=633512167095000111}
16:11:49.625: Outgoing: etch.examples.example.Example._result_hello(92919767): {_inReplyTo(-307705434)=633512167095000111, result(-2130379326)=0}
16:11:49.625: Incoming: etch.examples.example.Example.hello(-1567573670): {msg(769750364)=I am printing message 4, _messageId(1661383784)=633512167095000148}
16:11:49.625: Outgoing: etch.examples.example.Example._result_hello(92919767): {_inReplyTo(-307705434)=633512167095000148, result(-2130379326)=0}
16:11:49.625: Incoming: etch.examples.example.Example.hello(-1567573670): {msg(769750364)=I am printing message 5, _messageId(1661383784)=633512167095000185}
16:11:49.625: Outgoing: etch.examples.example.Example._result_hello(92919767): {_inReplyTo(-307705434)=633512167095000185, result(-2130379326)=0}
16:11:49.625: Incoming: etch.examples.example.Example.hello(-1567573670): {msg(769750364)=I am printing message 6, _messageId(1661383784)=633512167095000222}
16:11:49.625: Outgoing: etch.examples.example.Example._result_hello(92919767): {_inReplyTo(-307705434)=633512167095000222, result(-2130379326)=0}
16:11:49.625: Incoming: etch.examples.example.Example.hello(-1567573670): {msg(769750364)=I am printing message 7, _messageId(1661383784)=633512167095000259}
16:11:49.625: Outgoing: etch.examples.example.Example._result_hello(92919767): {_inReplyTo(-307705434)=633512167095000259, result(-2130379326)=0}

Issues

  • How to prevent overwriting of log file ?

The current solution is to rename the older log file. The name of the file will be based on the current time. Image below depicts the name format of the older log files

  • When to flush the contents of the buffer to file ?

Option 1 is to flush the contents immediately (may lead to a performance hit)
Option 2 is to do it periodically (user will be given the flexibility to chose the time interval for e.g. user can specify flush buffer every 2 minutes)
Option 3 is not to flush the buffer at all

Currently only Option 1 has been implemented.

  • Should we set a limit on the file size ? In other words, how large should we allow a log file to get before we create a new log file ?
  • At some point, should very old log files be deleted ?