How do I enable DynamoDB Local Logging?
- Go to the directory that has the DynamoDBLocal.jar
- Create a file called log4j2.xml with these contents:
<?xml version="1.0" encoding="UTF-8"?> <Configuration status="WARN"> <Appenders> <Console name="Console" target="SYSTEM_OUT"> <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/> </Console> </Appenders> <Loggers> <Logger name="com.amazonaws.services.dynamodbv2.local" level="DEBUG"> <AppenderRef ref="Console"/> </Logger> <Logger name="com.amazonaws.services.dynamodbv2.local.shared.access.sqlite.SQLiteDBAccess" level="INFO"> <AppenderRef ref="Console"/> </Logger> <Root level="WARN"> <AppenderRef ref="Console"/> </Root> </Loggers> </Configuration>
- Remove the existing log4j2.xml from the jar
zip -d DynamoDBLocal.jar log4j2.xml
- Add the created log4j2.xml to the jar
zip -u DynamoDBLocal.jar log4j2.xml
or simply edit the log4j2.xml in the DynamoDBLocal.jar using 7-Zip etc. and overwrite it with the xml above and skip the steps 2-4.
- Change to the directory with DynamoDBLocal.jar
Create a new file called log4j.properties with the contents:
log4j.rootLogger=DEBUG, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=LOG%d %p [%c] - %m%n
Remove the existing log4j.properties files from the jar (there might be two)
zip -d DynamoDBLocal.jar log4j.properties
zip -d DynamoDBLocal.jar log4j.properties
Add the new properties file to the jar
zip -u DynamoDBLocal.jar log4j.properties
Source: https://gist.github.com/mdaley/aaf9b62d90f6817eb72a