@@ -61,22 +61,18 @@ public void testLog() throws Exception {
6161 setUpLoggerForTest (SLF4JLog .DEFAULT_EVENT_CATEGORY );
6262 log .onEvent (loggedText );
6363 assertMessageLogged (SLF4JLog .DEFAULT_EVENT_CATEGORY , sessionID , loggedText );
64- removeLogHandlers (SLF4JLog .DEFAULT_EVENT_CATEGORY );
6564
6665 setUpLoggerForTest (SLF4JLog .DEFAULT_ERROR_EVENT_CATEGORY );
6766 log .onErrorEvent (loggedText );
6867 assertMessageLogged (SLF4JLog .DEFAULT_ERROR_EVENT_CATEGORY , sessionID , loggedText );
69- removeLogHandlers (SLF4JLog .DEFAULT_ERROR_EVENT_CATEGORY );
7068
7169 setUpLoggerForTest (SLF4JLog .DEFAULT_INCOMING_MSG_CATEGORY );
7270 log .onIncoming (loggedText );
7371 assertMessageLogged (SLF4JLog .DEFAULT_INCOMING_MSG_CATEGORY , sessionID , loggedText );
74- removeLogHandlers (SLF4JLog .DEFAULT_INCOMING_MSG_CATEGORY );
7572
7673 setUpLoggerForTest (SLF4JLog .DEFAULT_OUTGOING_MSG_CATEGORY );
7774 log .onOutgoing (loggedText );
7875 assertMessageLogged (SLF4JLog .DEFAULT_OUTGOING_MSG_CATEGORY , sessionID , loggedText );
79- removeLogHandlers (SLF4JLog .DEFAULT_OUTGOING_MSG_CATEGORY );
8076
8177 settings .setString (sessionID , SLF4JLogFactory .SETTING_EVENT_CATEGORY , "event" );
8278 settings .setString (sessionID , SLF4JLogFactory .SETTING_ERROR_EVENT_CATEGORY , "errorEvent" );
@@ -87,21 +83,27 @@ public void testLog() throws Exception {
8783 setUpLoggerForTest ("event" );
8884 log .onEvent (loggedText );
8985 assertMessageLogged ("event" , sessionID , loggedText );
90- removeLogHandlers ("event" );
9186
9287 setUpLoggerForTest ("errorEvent" );
9388 log .onErrorEvent (loggedText );
9489 assertMessageLogged ("errorEvent" , sessionID , loggedText );
95- removeLogHandlers ("errorEvent" );
9690
9791 setUpLoggerForTest ("in" );
9892 log .onIncoming (loggedText );
9993 assertMessageLogged ("in" , sessionID , loggedText );
100- removeLogHandlers ("in" );
10194
10295 setUpLoggerForTest ("out" );
10396 log .onOutgoing (loggedText );
10497 assertMessageLogged ("out" , sessionID , loggedText );
98+
99+ // cleanup
100+ removeLogHandlers (SLF4JLog .DEFAULT_EVENT_CATEGORY );
101+ removeLogHandlers (SLF4JLog .DEFAULT_ERROR_EVENT_CATEGORY );
102+ removeLogHandlers (SLF4JLog .DEFAULT_INCOMING_MSG_CATEGORY );
103+ removeLogHandlers (SLF4JLog .DEFAULT_OUTGOING_MSG_CATEGORY );
104+ removeLogHandlers ("event" );
105+ removeLogHandlers ("errorEvent" );
106+ removeLogHandlers ("in" );
105107 removeLogHandlers ("out" );
106108 }
107109
@@ -120,24 +122,24 @@ public void testLogHeartbeatFiltering() throws Exception {
120122 setUpLoggerForTest (SLF4JLog .DEFAULT_INCOMING_MSG_CATEGORY );
121123 log .onIncoming (loggedText );
122124 assertMessageLogged (SLF4JLog .DEFAULT_INCOMING_MSG_CATEGORY , sessionID , loggedText );
123- removeLogHandlers (SLF4JLog .DEFAULT_INCOMING_MSG_CATEGORY );
124125
125126 setUpLoggerForTest (SLF4JLog .DEFAULT_OUTGOING_MSG_CATEGORY );
126127 log .onOutgoing (loggedText );
127128 assertMessageLogged (SLF4JLog .DEFAULT_OUTGOING_MSG_CATEGORY , sessionID , loggedText );
128- removeLogHandlers (SLF4JLog .DEFAULT_OUTGOING_MSG_CATEGORY );
129129
130130 settings .setBool (sessionID , SLF4JLogFactory .SETTING_LOG_HEARTBEATS , false );
131131 log = (SLF4JLog ) factory .create (sessionID );
132132
133133 setUpLoggerForTest (SLF4JLog .DEFAULT_INCOMING_MSG_CATEGORY );
134134 log .onIncoming (loggedText );
135135 assertMessageNotLogged (SLF4JLog .DEFAULT_INCOMING_MSG_CATEGORY );
136- removeLogHandlers (SLF4JLog .DEFAULT_INCOMING_MSG_CATEGORY );
137136
138137 setUpLoggerForTest (SLF4JLog .DEFAULT_OUTGOING_MSG_CATEGORY );
139138 log .onOutgoing (loggedText );
140139 assertMessageNotLogged (SLF4JLog .DEFAULT_OUTGOING_MSG_CATEGORY );
140+
141+ // cleanup
142+ removeLogHandlers (SLF4JLog .DEFAULT_INCOMING_MSG_CATEGORY );
141143 removeLogHandlers (SLF4JLog .DEFAULT_OUTGOING_MSG_CATEGORY );
142144 }
143145
@@ -157,24 +159,26 @@ public void testLogFilteredByLevel() throws Exception {
157159 getTestHandler (SLF4JLog .DEFAULT_EVENT_CATEGORY ).setLevel (Level .WARNING );
158160 log .onEvent (loggedText );
159161 assertMessageNotLogged (SLF4JLog .DEFAULT_EVENT_CATEGORY );
160- removeLogHandlers (SLF4JLog .DEFAULT_EVENT_CATEGORY );
161162
162163 setUpLoggerForTest (SLF4JLog .DEFAULT_ERROR_EVENT_CATEGORY );
163164 getTestHandler (SLF4JLog .DEFAULT_ERROR_EVENT_CATEGORY ).setLevel (Level .SEVERE );
164165 log .onErrorEvent (loggedText );
165166 assertMessageNotLogged (SLF4JLog .DEFAULT_EVENT_CATEGORY );
166- removeLogHandlers (SLF4JLog .DEFAULT_ERROR_EVENT_CATEGORY );
167167
168168 setUpLoggerForTest (SLF4JLog .DEFAULT_INCOMING_MSG_CATEGORY );
169169 getTestHandler (SLF4JLog .DEFAULT_INCOMING_MSG_CATEGORY ).setLevel (Level .WARNING );
170170 log .onIncoming (loggedText );
171171 assertMessageNotLogged (SLF4JLog .DEFAULT_INCOMING_MSG_CATEGORY );
172- removeLogHandlers (SLF4JLog .DEFAULT_INCOMING_MSG_CATEGORY );
173172
174173 setUpLoggerForTest (SLF4JLog .DEFAULT_OUTGOING_MSG_CATEGORY );
175174 getTestHandler (SLF4JLog .DEFAULT_OUTGOING_MSG_CATEGORY ).setLevel (Level .WARNING );
176175 log .onOutgoing (loggedText );
177176 assertMessageNotLogged (SLF4JLog .DEFAULT_OUTGOING_MSG_CATEGORY );
177+
178+ // cleanup
179+ removeLogHandlers (SLF4JLog .DEFAULT_EVENT_CATEGORY );
180+ removeLogHandlers (SLF4JLog .DEFAULT_ERROR_EVENT_CATEGORY );
181+ removeLogHandlers (SLF4JLog .DEFAULT_INCOMING_MSG_CATEGORY );
178182 removeLogHandlers (SLF4JLog .DEFAULT_OUTGOING_MSG_CATEGORY );
179183 }
180184
0 commit comments