File tree Expand file tree Collapse file tree 3 files changed +42
-2
lines changed
main/java/co/elastic/logging/log4j2
test/java/co/elastic/logging/log4j2 Expand file tree Collapse file tree 3 files changed +42
-2
lines changed Original file line number Diff line number Diff line change 1
1
target
2
+ .idea
3
+ ** .iml
Original file line number Diff line number Diff line change @@ -310,11 +310,11 @@ public static class Builder extends AbstractStringLayout.Builder<EcsLayout.Build
310
310
@ PluginBuilderAttribute ("stackTraceAsArray" )
311
311
private boolean stackTraceAsArray = false ;
312
312
@ PluginElement ("AdditionalField" )
313
- private KeyValuePair [] additionalFields ;
313
+ private KeyValuePair [] additionalFields = new KeyValuePair [] {} ;
314
314
@ PluginBuilderAttribute ("topLevelLabels" )
315
315
private String topLevelLabels ;
316
316
@ PluginBuilderAttribute ("includeOrigin" )
317
- private boolean includeOrigin ;
317
+ private boolean includeOrigin = false ;
318
318
319
319
Builder () {
320
320
super ();
Original file line number Diff line number Diff line change
1
+ /*-
2
+ * #%L
3
+ * Java ECS logging
4
+ * %%
5
+ * Copyright (C) 2019 Elastic and contributors
6
+ * %%
7
+ * Licensed to Elasticsearch B.V. under one or more contributor
8
+ * license agreements. See the NOTICE file distributed with
9
+ * this work for additional information regarding copyright
10
+ * ownership. Elasticsearch B.V. licenses this file to you under
11
+ * the Apache License, Version 2.0 (the "License"); you may
12
+ * not use this file except in compliance with the License.
13
+ * You may obtain a copy of the License at
14
+ *
15
+ * http://www.apache.org/licenses/LICENSE-2.0
16
+ *
17
+ * Unless required by applicable law or agreed to in writing,
18
+ * software distributed under the License is distributed on an
19
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20
+ * KIND, either express or implied. See the License for the
21
+ * specific language governing permissions and limitations
22
+ * under the License.
23
+ * #L%
24
+ */
25
+ package co .elastic .logging .log4j2 ;
26
+
27
+ import org .junit .jupiter .api .Test ;
28
+
29
+ import static org .assertj .core .api .Assertions .assertThat ;
30
+
31
+ class Log4j2EcsBuilderTest {
32
+
33
+ @ Test
34
+ void testAdditionalFieldsCanBeEmptyInBuilder () {
35
+ EcsLayout ecsLayout = EcsLayout .newBuilder ().setServiceName ("test" ).build ();
36
+ assertThat (ecsLayout ).isNotNull ();
37
+ }
38
+ }
You can’t perform that action at this time.
0 commit comments