3939 * a value is case-insensitive. If not specified, defaults to <em>info</em>.</li>
4040 * <li><strong>levelInBrackets</strong> - Should the level string be output in brackets?
4141 * Defaults to {@code false}.</li>
42+ * <li><strong>requestId</strong> - Set the context name of <strong>AWS request ID</strong>.
43+ * Defaults to {@code AWS_REQUEST_ID}.</li>
4244 * <li><strong>showDateTime</strong> - Set to {@code true} if you want the current date and time
4345 * to be included in output messages. Defaults to {@code false}.</li>
4446 * <li><strong>showLogName</strong> - Set to {@code true} if you want the Logger instance name
5153 * the current thread name. Defaults to {@code false}.</li>
5254 * </ul>
5355 * <p>
54- * The environment variables overrides the properties: <strong>LOG_DATE_TIME_FORMAT </strong>,
55- * <strong>LOG_DEFAULT_LEVEL </strong>, <strong>LOG_LEVEL_IN_BRACKETS </strong>,
56- * <strong>LOG_SHOW_DATE_TIME </strong>, <strong>LOG_SHOW_NAME </strong>,
57- * <strong>LOG_SHOW_SHORT_NAME </strong>, <strong>LOG_SHOW_THREAD_ID </strong>,
58- * <strong>LOG_SHOW_THREAD_NAME</strong>.
56+ * The environment variables overrides the properties: <strong>LOG_AWS_REQUEST_ID </strong>,
57+ * <strong>LOG_DATE_TIME_FORMAT </strong>, <strong>LOG_DEFAULT_LEVEL </strong>,
58+ * <strong>LOG_LEVEL_IN_BRACKETS </strong>, <strong>LOG_SHOW_DATE_TIME </strong>,
59+ * <strong>LOG_SHOW_NAME </strong>, <strong>LOG_SHOW_SHORT_NAME </strong>,
60+ * <strong>LOG_SHOW_THREAD_ID</strong>, <strong> LOG_SHOW_THREAD_NAME</strong>.
5961 */
6062public class LambdaLoggerConfiguration {
6163
@@ -66,6 +68,7 @@ public class LambdaLoggerConfiguration {
6668 private final Level loggerLevel ;
6769 private final String logName ;
6870 private final String name ;
71+ private final String requestId ;
6972 private final boolean showDateTime ;
7073 private final boolean showThreadId ;
7174 private final boolean showThreadName ;
@@ -82,6 +85,7 @@ private LambdaLoggerConfiguration(Builder builder) {
8285 } else {
8386 logName = null ;
8487 }
88+ requestId = builder .requestId ;
8589 showDateTime = builder .showDateTime ;
8690 showThreadId = builder .showThreadId ;
8791 showThreadName = builder .showThreadName ;
@@ -111,6 +115,10 @@ public String name() {
111115 return name ;
112116 }
113117
118+ public String requestId () {
119+ return requestId ;
120+ }
121+
114122 public boolean showDateTime () {
115123 return showDateTime ;
116124 }
@@ -132,6 +140,7 @@ public static class Builder {
132140 private boolean levelInBrackets ;
133141 private Level loggerLevel ;
134142 private String name ;
143+ private String requestId ;
135144 private boolean showDateTime ;
136145 private boolean showLogName ;
137146 private boolean showShortLogName ;
@@ -149,6 +158,7 @@ private Builder() {
149158 public LambdaLoggerConfiguration build () {
150159 requireNonNull (loggerLevel , "Logger level is null" );
151160 requireNonNull (name , "Logger name is null" );
161+ requireNonNull (requestId , "AWS request ID is null" );
152162 return new LambdaLoggerConfiguration (this );
153163 }
154164
@@ -205,6 +215,17 @@ public Builder name(@NotNull String name) {
205215 return this ;
206216 }
207217
218+ /**
219+ * Context name of AWS request ID.
220+ *
221+ * @param requestId context name of AWS request ID
222+ * @return a builder
223+ */
224+ public Builder requestId (@ NotNull String requestId ) {
225+ this .requestId = requestId ;
226+ return this ;
227+ }
228+
208229 /**
209230 * Set to {@code true} if you want the current date and time to be included in output messages.
210231 * <p>
0 commit comments