DynamoDBTraceListener is a custom TraceListener that logs events to a DynamoDB table. The listener can be configured through the application's .config file or by instantiating an instance of DynamoDBTraceListener and setting the Configuration property on the instance.
The target table must have a string hash key and a string range key. If the table does not exist the listener will create it during initialization with default read and write units set to 1 and 10, respectively, unless configured otherwise.
While DynamoDBTraceListener is running, it will write temporary log files into current directory. These log files will be deleted once the data is pushed to DynamoDB. The logs are pushed to DynamoDB under the following conditions: 1. Flush is called on the DynamoDBTraceListener 2. Close is called on the DynamoDBTraceListener 3. WritePeriod has elapsed since last write (If the listener is used with the SDK clients, Flush is invoked when the client is disposed.) If the application exits and there are still log files (in the event Flush is not invoked or the application terminates unexpectedly), these log files will be pushed to DynamoDB on the next execution of the application. Log files can also be flushed manually by creating an instance of DynamoDBTraceListener and using the FlushLog method on a particular log file.
Example of an app.config entry setting up the listener with all possible configurations specified: