@@ -78,7 +78,6 @@ public void shouldPrintControllerException() throws IOException, ServletExceptio
78
78
Map log0 = JsonHelper .toMap (logs [0 ]);
79
79
the (log0 .get ("level" )).shouldBeEqual ("INFO" );
80
80
the (log0 .get ("logger" )).shouldBeEqual ("org.javalite.activeweb.RequestDispatcher" );
81
-
82
81
Map message = (Map ) log0 .get ("message" );
83
82
the (message .get ("info" )).shouldBeEqual ("executing controller" );
84
83
the (message .get ("controller" )).shouldBeEqual ("app.controllers.LoggingController" );
@@ -87,33 +86,24 @@ public void shouldPrintControllerException() throws IOException, ServletExceptio
87
86
88
87
//Line 1
89
88
Map log1 = JsonHelper .toMap (logs [1 ]);
90
- the (log1 .get ("level" )).shouldBeEqual ("INFO " );
89
+ the (log1 .get ("level" )).shouldBeEqual ("ERROR " );
91
90
the (log1 .get ("timestamp" )).shouldNotBeNull ();
92
91
the (log1 .get ("logger" )).shouldBeEqual ("org.javalite.activeweb.RequestDispatcher" );
93
-
94
92
message = (Map ) log1 .get ("message" );
95
93
the (message .get ("controller" )).shouldBeEqual ("app.controllers.LoggingController" );
96
94
the (message .get ("duration_millis" )).shouldNotBeNull ();
97
95
the (message .get ("method" )).shouldBeEqual ("GET" );
98
96
the (message .get ("status" )).shouldBeEqual (500 );
97
+ Map exception = (Map ) log1 .get ("exception" );
98
+ the (exception .get ("message" )).shouldBeEqual ("blah!" );
99
+ the (exception .get ("stacktrace" )).shouldContain ("java.lang.RuntimeException: blah!\n java.lang.RuntimeException: blah!\n \t at app.controllers.LoggingController.error" );
99
100
100
101
//Line 2
101
102
Map log2 = JsonHelper .toMap (logs [2 ]);
102
- the (log2 .get ("level" )).shouldBeEqual ("ERROR " );
103
+ the (log2 .get ("level" )).shouldBeEqual ("INFO " );
103
104
the (log2 .get ("timestamp" )).shouldNotBeNull ();
104
- the (log2 .get ("logger" )).shouldBeEqual ("org.javalite.activeweb.RequestDispatcher" );
105
- the (log2 .get ("message" )).shouldBeEqual ("ERROR!" );
106
-
107
- Map exception = (Map ) log2 .get ("exception" );
108
- the (exception .get ("message" )).shouldBeEqual ("blah!" );
109
- the (exception .get ("stacktrace" )).shouldContain ("java.lang.RuntimeException: blah!\n java.lang.RuntimeException: blah!\n \t at app.controllers.LoggingController.error" );
110
-
111
- //Line 3
112
- Map log3 = JsonHelper .toMap (logs [3 ]);
113
- the (log3 .get ("level" )).shouldBeEqual ("INFO" );
114
- the (log3 .get ("timestamp" )).shouldNotBeNull ();
115
- the (log3 .get ("logger" )).shouldBeEqual ("org.javalite.activeweb.freemarker.FreeMarkerTemplateManager" );
116
- the (log3 .get ("message" )).shouldBeEqual ("rendering template: '/system/error' with layout: '/layouts/default_layout" );
105
+ the (log2 .get ("logger" )).shouldBeEqual ("org.javalite.activeweb.freemarker.FreeMarkerTemplateManager" );
106
+ the (log2 .get ("message" )).shouldBeEqual ("rendering template: '/system/error' with layout: '/layouts/default_layout" );
117
107
}
118
108
119
109
@ Test
0 commit comments