File tree 3 files changed +24
-0
lines changed
qa/logging-config/src/test
java/org/elasticsearch/common/logging
resources/org/elasticsearch/common/logging/json_layout
3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ appender.deprecation_rolling_old.name = deprecation_rolling_old
82
82
appender.deprecation_rolling_old.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_deprecation.log
83
83
appender.deprecation_rolling_old.layout.type = PatternLayout
84
84
appender.deprecation_rolling_old.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%marker %m%n
85
+ appender.deprecation_rolling_old.filter.rate_limit.type = RateLimitingFilter
85
86
86
87
appender.deprecation_rolling_old.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\
87
88
_deprecation-%i.log.gz
Original file line number Diff line number Diff line change 28
28
import org .junit .BeforeClass ;
29
29
30
30
import java .io .IOException ;
31
+ import java .nio .file .Files ;
31
32
import java .nio .file .Path ;
32
33
import java .util .List ;
33
34
import java .util .Map ;
40
41
import static org .hamcrest .Matchers .hasEntry ;
41
42
import static org .hamcrest .Matchers .hasKey ;
42
43
import static org .hamcrest .Matchers .not ;
44
+ import static org .hamcrest .core .IsEqual .equalTo ;
43
45
44
46
/**
45
47
* This test confirms JSON log structure is properly formatted and can be parsed.
@@ -290,6 +292,9 @@ public void testDuplicateLogMessages() throws Exception {
290
292
)
291
293
);
292
294
}
295
+
296
+ long oldStyleDeprecationLogCount = oldStyleDeprecationLogCount ();
297
+ assertThat (oldStyleDeprecationLogCount , equalTo (1L ));
293
298
});
294
299
295
300
// For the same key and different X-Opaque-ID should be multiple times per key/x-opaque-id
@@ -330,10 +335,20 @@ public void testDuplicateLogMessages() throws Exception {
330
335
)
331
336
)
332
337
);
338
+
339
+ long oldStyleDeprecationLogCount = oldStyleDeprecationLogCount ();
340
+ assertThat (oldStyleDeprecationLogCount , equalTo (2L ));
333
341
}
334
342
});
335
343
}
336
344
345
+ private long oldStyleDeprecationLogCount () throws IOException {
346
+ try (Stream <String > lines = Files .lines (PathUtils .get (System .getProperty ("es.logs.base_path" ),
347
+ System .getProperty ("es.logs.cluster_name" ) + "_deprecated.log" ))){
348
+ return lines .count ();
349
+ }
350
+ }
351
+
337
352
private List <JsonLogLine > collectLines (Stream <JsonLogLine > stream ) {
338
353
return stream
339
354
.skip (1 )//skip the first line from super class
Original file line number Diff line number Diff line change @@ -17,6 +17,13 @@ appender.deprecated.layout.type_name = deprecation
17
17
appender.deprecated.layout.esmessagefields = x-opaque-id
18
18
appender.deprecated.filter.rate_limit.type = RateLimitingFilter
19
19
20
+ appender.deprecation_rolling_old.type = File
21
+ appender.deprecation_rolling_old.name = deprecation_rolling_old
22
+ appender.deprecation_rolling_old.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_deprecated.log
23
+ appender.deprecation_rolling_old.layout.type = PatternLayout
24
+ appender.deprecation_rolling_old.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%marker %m%n
25
+ appender.deprecation_rolling_old.filter.rate_limit.type = RateLimitingFilter
26
+
20
27
appender.deprecatedconsole.type = Console
21
28
appender.deprecatedconsole.name = deprecatedconsole
22
29
appender.deprecatedconsole.layout.type = ESJsonLayout
@@ -44,6 +51,7 @@ logger.deprecation.level = deprecation
44
51
logger.deprecation.appenderRef.console.ref = console
45
52
logger.deprecation.appenderRef.file.ref = file
46
53
logger.deprecation.appenderRef.deprecation_rolling.ref = deprecated
54
+ logger.deprecation.appenderRef.deprecation_rolling_old.ref = deprecation_rolling_old
47
55
logger.deprecation.appenderRef.deprecatedconsole.ref = deprecatedconsole
48
56
logger.deprecation.appenderRef.header_warning.ref = header_warning
49
57
logger.deprecation.additivity = false
You can’t perform that action at this time.
0 commit comments