This repository was archived by the owner on Jun 4, 2024. It is now read-only.
File tree 3 files changed +26
-2
lines changed
main/java/uk/bot_by/aws_lambda/slf4j
test/java/uk/bot_by/aws_lambda/slf4j
3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 14
14
# KIND, either express or implied. See the License for the
15
15
# specific language governing permissions and limitations
16
16
# under the License.
17
- distributionUrl =https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6 /apache-maven-3.8.6 -bin.zip
17
+ distributionUrl =https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7 /apache-maven-3.8.7 -bin.zip
18
18
wrapperUrl =https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
Original file line number Diff line number Diff line change @@ -278,7 +278,7 @@ private Properties loadProperties(String configurationFile) {
278
278
try (InputStream configurationInputStream = Thread .currentThread ().getContextClassLoader ()
279
279
.getResourceAsStream (configurationFile )) {
280
280
properties .load (configurationInputStream );
281
- } catch (IOException e ) {
281
+ } catch (IOException | NullPointerException e ) {
282
282
// ignored
283
283
}
284
284
Original file line number Diff line number Diff line change @@ -305,4 +305,28 @@ void useLoggerProperties() {
305
305
"properties-request-id \\ d{2}:\\ d{2}:\\ d{2}\\ .\\ d{3} \\ [main\\ ] thread=1 \\ [DEBUG\\ ] test - debug message[\\ n\\ r]+" ));
306
306
}
307
307
308
+ @ DisplayName ("Try to read missed logger properties file, use default values" )
309
+ @ Test
310
+ void missedProperties () {
311
+ // given
312
+ var loggerFactory = spy (new LambdaLoggerFactory ("missed.properties" ));
313
+
314
+ doReturn (printStream ).when (loggerFactory ).getPrintStream ();
315
+
316
+ MDC .put ("request#" , "properties-request-id" );
317
+
318
+ // when
319
+ var logger = loggerFactory .getLogger ("lambda.logger.test" );
320
+
321
+ logger .debug ("debug message" );
322
+ logger .info ("info message" );
323
+
324
+ // then
325
+ printStream .flush ();
326
+ printStream .close ();
327
+ outputStream .toString (StandardCharsets .UTF_8 );
328
+ assertThat (outputStream .toString (StandardCharsets .UTF_8 ), matchesPattern (
329
+ "INFO lambda.logger.test - info message[\\ n\\ r]+" ));
330
+ }
331
+
308
332
}
You can’t perform that action at this time.
0 commit comments