@@ -32,23 +32,52 @@ protected void call(String line) {
3232 try {
3333 Map <String , Object > jsonLog = (Map <String , Object >) MAPPER .readValue (line , Object .class );
3434
35- HashMap <String , Object > additional = new HashMap <>(jsonLog );
36- additional .remove ("ts" );
37- additional .remove ("pid" );
35+ String level ;
36+ String ts ;
37+ String thread ;
38+ String type ;
39+ String msg ;
40+ HashMap <String , Object > additional = new HashMap <>();
41+
42+ if (jsonLog .containsKey ("info" )) {
43+ Map <String , Object > infoLog = (Map <String , Object >) jsonLog .get ("info" );
44+
45+ level = (String ) infoLog .get ("level" );
46+ ts = (String ) infoLog .get ("ts" );
47+ thread = (String ) infoLog .get ("thread" );
48+ type = (String ) infoLog .get ("name" );
49+ msg = (String ) infoLog .get ("msg" );
50+
51+ additional .putAll (infoLog );
52+ } else {
53+ level = (String ) jsonLog .get ("level" );
54+ ts = (String ) jsonLog .get ("ts" );
55+ thread = (String ) jsonLog .get ("thread_name" );
56+ type = (String ) jsonLog .get ("type" );
57+ msg = (String ) jsonLog .get ("msg" );
58+ }
59+
60+ additional .remove ("category" );
61+ additional .remove ("code" );
3862 additional .remove ("invocation_id" );
3963 additional .remove ("level" );
4064 additional .remove ("log_version" );
4165 additional .remove ("code" );
4266 additional .remove ("msg" );
67+ additional .remove ("thread" );
4368 additional .remove ("thread_name" );
4469 additional .remove ("type" );
70+ additional .remove ("name" );
71+ additional .remove ("ts" );
72+ additional .remove ("pid" );
73+ additional .remove ("extra" );
4574
4675 String format = "[Date: {}] [Thread: {}] [Type: {}] {}{}" ;
4776 String [] args = new String []{
48- ( String ) jsonLog . get ( "ts" ) ,
49- ( String ) jsonLog . get ( "thread_name" ) ,
50- ( String ) jsonLog . get ( " type" ) ,
51- jsonLog . get ( " msg" ) != null ? jsonLog . get ( " msg" ) + " " : "" ,
77+ ts ,
78+ thread ,
79+ type ,
80+ msg != null ? msg + " " : "" ,
5281 additional .size () > 0 ? additional .toString () : ""
5382 };
5483
@@ -64,7 +93,7 @@ protected void call(String line) {
6493 }
6594 }
6695
67- switch (( String ) jsonLog . get ( " level" ) ) {
96+ switch (level ) {
6897 case "debug" :
6998 logger .debug (format , (Object []) args );
7099 break ;
0 commit comments