File tree Expand file tree Collapse 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 Expand file tree Collapse file tree 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
8282appender.deprecation_rolling_old.fileName = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}_deprecation.log
8383appender.deprecation_rolling_old.layout.type = PatternLayout
8484appender.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
8586
8687appender.deprecation_rolling_old.filePattern = ${sys:es.logs.base_path}${sys:file.separator}${sys:es.logs.cluster_name}\
8788 _deprecation-%i.log.gz
Original file line number Diff line number Diff line change 2828import org .junit .BeforeClass ;
2929
3030import java .io .IOException ;
31+ import java .nio .file .Files ;
3132import java .nio .file .Path ;
3233import java .util .List ;
3334import java .util .Map ;
4041import static org .hamcrest .Matchers .hasEntry ;
4142import static org .hamcrest .Matchers .hasKey ;
4243import static org .hamcrest .Matchers .not ;
44+ import static org .hamcrest .core .IsEqual .equalTo ;
4345
4446/**
4547 * This test confirms JSON log structure is properly formatted and can be parsed.
@@ -290,6 +292,9 @@ public void testDuplicateLogMessages() throws Exception {
290292 )
291293 );
292294 }
295+
296+ long oldStyleDeprecationLogCount = oldStyleDeprecationLogCount ();
297+ assertThat (oldStyleDeprecationLogCount , equalTo (1L ));
293298 });
294299
295300 // 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 {
330335 )
331336 )
332337 );
338+
339+ long oldStyleDeprecationLogCount = oldStyleDeprecationLogCount ();
340+ assertThat (oldStyleDeprecationLogCount , equalTo (2L ));
333341 }
334342 });
335343 }
336344
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+
337352 private List <JsonLogLine > collectLines (Stream <JsonLogLine > stream ) {
338353 return stream
339354 .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
1717appender.deprecated.layout.esmessagefields = x-opaque-id
1818appender.deprecated.filter.rate_limit.type = RateLimitingFilter
1919
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+
2027appender.deprecatedconsole.type = Console
2128appender.deprecatedconsole.name = deprecatedconsole
2229appender.deprecatedconsole.layout.type = ESJsonLayout
@@ -44,6 +51,7 @@ logger.deprecation.level = deprecation
4451logger.deprecation.appenderRef.console.ref = console
4552logger.deprecation.appenderRef.file.ref = file
4653logger.deprecation.appenderRef.deprecation_rolling.ref = deprecated
54+ logger.deprecation.appenderRef.deprecation_rolling_old.ref = deprecation_rolling_old
4755logger.deprecation.appenderRef.deprecatedconsole.ref = deprecatedconsole
4856logger.deprecation.appenderRef.header_warning.ref = header_warning
4957logger.deprecation.additivity = false
You can’t perform that action at this time.
0 commit comments