15

More than often DynamoDB Local does not show descriptive error messages, in order to see internal errors you need to enable logging.

What are the steps to enable DynamoDB Local logging on the standard output?

b-s-d
  • 4,953
  • 2
  • 25
  • 31

2 Answers2

15
  1. Go to the directory that has the DynamoDBLocal.jar
  2. 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>
  1. Remove the existing log4j2.xml from the jar

zip -d DynamoDBLocal.jar log4j2.xml

  1. 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.

chaixxiv
  • 421
  • 4
  • 6
  • this should be the right answer. Only thing I had to fix was some issue with white characters when I copied the content of that xml. Just sanitise it in some file editor. – kazuar Sep 18 '18 at 10:41
1
  1. Change to the directory with DynamoDBLocal.jar
  2. 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

  3. 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

  4. Add the new properties file to the jar

    zip -u DynamoDBLocal.jar log4j.properties

Source: https://gist.github.com/mdaley/aaf9b62d90f6817eb72a

b-s-d
  • 4,953
  • 2
  • 25
  • 31
  • Alas, it doesn't seem to have any effect with dynamodb_local_2015-07-16_1.0.tar.gz – Bulletmagnet Mar 01 '16 at 15:52
  • Also doesn't seem to work with dynamodb_local_2016-05-17. – James Irwin Jun 07 '16 at 10:40
  • Yeah can confirm on dynamodb_local_2016-05-17. Not getting anything logged even though I'm getting errors using dynamo local (And I'm getting `The request processing has failed because of an unknown error` when trying `aws dynamodb list-tables --endpoint-url http://localhost:8000`) – johnboiles Jan 13 '17 at 23:58