title: Change Log4j level using environment variables in AWS Lambda (java)
body: <p>I have AWS Lambdas coded using Java8. I am using Log4j1.2.17 for logging needs:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;log4j&lt;/groupId&gt;
      &lt;artifactId&gt;log4j&lt;/artifactId&gt;
      &lt;version&gt;${log4j.version}&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>The logging configuration is specified using log4.properties file as follows:</p>
  
  <pre><code># Root logger option
  log4j.rootLogger=INFO, stdout
  
  # Direct log messages to stdout
  log4j.appender.stdout=org.apache.log4j.ConsoleAppender
  log4j.appender.stdout.Target=System.out
  log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
  log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
  </code></pre>
  
  <p>As you can see currently the log level is set to "info". i want to change log level using the AWS Lambda environment variables such that if Debug is needed, set some Lambda environment variable and it should be reflected in Lambda function so that it starts logging in Debug statements. Any help will be appreciated. Thanks</p>