C# (CSharp) Amazon.TraceListener Namespace

Classes

Name Description
DynamoDBTraceListener

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: <system.diagnostics> <trace> <listeners> <add name="dynamo" type="Amazon.Logging.DynamoDBTraceListener, AWS.Extensions" AWSAccessKey="YOUR_ACCESS_KEY" AWSSecretKey="YOUR_SECRET_KEY" Region="us-west-2" Table="Logs" CreateIfNotExist="true" ReadCapacityUnits="1" WriteCapacityUnits="10" HashKey="Origin" RangeKey="Timestamp" MaxLength="10000" ExcludeAttributes="Callstack, Host" HashKeyFormat="{Host}-{EventType}-{ProcessId}" RangeKeyFormat="{Time}" WritePeriodMs="60000" LogFilesDir="C:\Logs" /> </listeners> </trace> </system.diagnostics>

DynamoDBTraceListener.Configs DynamoDBTraceListener configurations.