• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

openmrs / openmrs-core / 26982556974

04 Jun 2026 10:08PM UTC coverage: 63.677% (+0.3%) from 63.427%
26982556974

push

github

ibacher
TRUNK-6392: Improvements to the OpenMRS Logging plugin (#6104)

151 of 195 new or added lines in 8 files covered. (77.44%)

12 existing lines in 5 files now uncovered.

23830 of 37423 relevant lines covered (63.68%)

0.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/api/src/main/java/org/openmrs/util/MemoryAppender.java
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
3
 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
4
 * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
5
 * the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
6
 *
7
 * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
8
 * graphic logo is a trademark of OpenMRS Inc.
9
 */
10
package org.openmrs.util;
11

12
import java.io.Serializable;
13
import java.util.List;
14
import java.util.concurrent.TimeUnit;
15

16
import org.apache.logging.log4j.core.ErrorHandler;
17
import org.apache.logging.log4j.core.Filter;
18
import org.apache.logging.log4j.core.Layout;
19
import org.apache.logging.log4j.core.LogEvent;
20
import org.apache.logging.log4j.core.StringLayout;
21
import org.apache.logging.log4j.core.config.Property;
22

23
/**
24
 * This class stores a configurable number lines of the output from the log file.
25
 *
26
 * Note that this class is implemented as a single-buffer-per-appender-name meaning that each appender name can only support
27
 * a single configuration (the most recent applied)
28
 * 
29
 * @deprecated As of 2.4.4, 2.5.1, and 2.6.0 this class is moved to the org.openmrs.logging package
30
 */
31
@Deprecated
32
public class MemoryAppender extends org.openmrs.logging.MemoryAppender {
33
        
34
        private final org.openmrs.logging.MemoryAppender implementation;
35
        
36
        MemoryAppender(org.openmrs.logging.MemoryAppender implementation) {
NEW
37
                super(implementation.getName(), implementation.getFilter(), (StringLayout) implementation.getLayout(),
×
NEW
38
                        implementation.ignoreExceptions(), implementation.getPropertyArray(), implementation.getBufferSize());
×
39

40
                this.implementation = implementation;
×
41
        }
×
42
        
43
        protected MemoryAppender(String name, Filter filter,
44
                StringLayout layout, boolean ignoreExceptions,
45
                Property[] properties, int bufferSize) {
46
                super(name, filter, layout, ignoreExceptions, properties, bufferSize);
×
47
                
48
                implementation = null;
×
49
        }
×
50
        
51
        @Override
52
        public void append(LogEvent logEvent) {
53
                if (implementation != null) {
×
54
                        implementation.append(logEvent);
×
55
                } else {
56
                        super.append(logEvent);
×
57
                }
58
        }
×
59
        
60
        @Override
61
        public int getBufferSize() {
62
                if (implementation != null) {
×
63
                        return implementation.getBufferSize();
×
64
                } else {
65
                        return super.getBufferSize();
×
66
                }
67
        }
68
        
69
        @Override
70
        public List<String> getLogLines() {
71
                if (implementation != null) {
×
72
                        return implementation.getLogLines();
×
73
                } else {
74
                        return super.getLogLines();
×
75
                }
76
        }
77
        
78
        @Override
79
        public boolean requiresLocation() {
80
                if (implementation != null) {
×
81
                        return implementation.requiresLocation();
×
82
                } else {
83
                        return super.requiresLocation();
×
84
                }
85
        }
86
        
87
        @Override
88
        public void error(String msg) {
89
                if (implementation != null) {
×
90
                        implementation.error(msg);
×
91
                } else {
92
                        super.error(msg);
×
93
                }
94
        }
×
95
        
96
        @Override
97
        public void error(String msg, LogEvent event, Throwable t) {
98
                if (implementation != null) {
×
99
                        implementation.error(msg, event, t);
×
100
                } else {
101
                        super.error(msg, event, t);
×
102
                }
103
        }
×
104
        
105
        @Override
106
        public void error(String msg, Throwable t) {
107
                if (implementation != null) {
×
108
                        implementation.error(msg, t);
×
109
                } else {
110
                        super.error(msg, t);
×
111
                }
112
        }
×
113
        
114
        @Override
115
        public ErrorHandler getHandler() {
116
                if (implementation != null) {
×
117
                        return implementation.getHandler();
×
118
                } else {
119
                        return super.getHandler();
×
120
                }
121
        }
122
        
123
        @Override
124
        public Layout<? extends Serializable> getLayout() {
125
                if (implementation != null) {
×
126
                        return implementation.getLayout();
×
127
                } else {
128
                        return super.getLayout();
×
129
                }
130
        }
131
        
132
        @Override
133
        public String getName() {
134
                if (implementation != null) {
×
135
                        return implementation.getName();
×
136
                } else {
137
                        return super.getName();
×
138
                }
139
        }
140
        
141
        @Override
142
        public boolean ignoreExceptions() {
143
                if (implementation != null) {
×
144
                        return implementation.ignoreExceptions();
×
145
                } else {
146
                        return super.ignoreExceptions();
×
147
                }
148
        }
149
        
150
        @Override
151
        public void setHandler(ErrorHandler handler) {
152
                if (implementation != null) {
×
153
                        implementation.setHandler(handler);
×
154
                } else {
155
                        super.setHandler(handler);
×
156
                }
157
        }
×
158
        
159
        @Override
160
        public String toString() {
161
                if (implementation != null) {
×
162
                        return implementation.toString();
×
163
                } else {
164
                        return super.toString();
×
165
                }
166
        }
167
        
168
        @Override
169
        public synchronized void addFilter(Filter filter) {
170
                if (implementation != null) {
×
171
                        implementation.addFilter(filter);
×
172
                } else {
173
                        super.addFilter(filter);
×
174
                }
175
        }
×
176
        
177
        @Override
178
        public Filter getFilter() {
179
                if (implementation != null) {
×
180
                        return implementation.getFilter();
×
181
                } else {
182
                        return super.getFilter();
×
183
                }
184
        }
185
        
186
        @Override
187
        public boolean hasFilter() {
188
                if (implementation != null) {
×
189
                        return implementation.hasFilter();
×
190
                } else {
191
                        return super.hasFilter();
×
192
                }
193
        }
194
        
195
        @Override
196
        public boolean isFiltered(LogEvent event) {
197
                if (implementation != null) {
×
198
                        return implementation.isFiltered(event);
×
199
                } else {
200
                        return super.isFiltered(event);
×
201
                }
202
        }
203
        
204
        @Override
205
        public synchronized void removeFilter(Filter filter) {
206
                if (implementation != null) {
×
207
                        implementation.removeFilter(filter);
×
208
                } else {
209
                        super.removeFilter(filter);
×
210
                }
211
        }
×
212
        
213
        @Override
214
        public void start() {
215
                if (implementation != null) {
×
216
                        implementation.start();
×
217
                } else {
218
                        super.start();
×
219
                }
220
        }
×
221
        
222
        @Override
223
        public boolean stop(long timeout, TimeUnit timeUnit) {
224
                if (implementation != null) {
×
225
                        return implementation.stop(timeout, timeUnit);
×
226
                } else {
227
                        return super.stop(timeout, timeUnit);
×
228
                }
229
        }
230
        
231
        @Override
232
        public Property[] getPropertyArray() {
233
                if (implementation != null) {
×
234
                        return implementation.getPropertyArray();
×
235
                } else {
236
                        return super.getPropertyArray();
×
237
                }
238
        }
239
        
240
        @Override
241
        public State getState() {
242
                if (implementation != null) {
×
243
                        return implementation.getState();
×
244
                } else {
245
                        return super.getState();
×
246
                }
247
        }
248
        
249
        @Override
250
        public boolean isInitialized() {
251
                if (implementation != null) {
×
252
                        return implementation.isInitialized();
×
253
                } else {
254
                        return super.isInitialized();
×
255
                }
256
        }
257
        
258
        @Override
259
        public boolean isStarted() {
260
                if (implementation != null) {
×
261
                        return implementation.isStarted();
×
262
                } else {
263
                        return super.isStarted();
×
264
                }
265
        }
266
        
267
        @Override
268
        public boolean isStarting() {
269
                if (implementation != null) {
×
270
                        return implementation.isStarting();
×
271
                } else {
272
                        return super.isStarting();
×
273
                }
274
        }
275
        
276
        @Override
277
        public boolean isStopped() {
278
                if (implementation != null) {
×
279
                        return implementation.isStopped();
×
280
                } else {
281
                        return super.isStopped();
×
282
                }
283
        }
284
        
285
        @Override
286
        public boolean isStopping() {
287
                if (implementation != null) {
×
288
                        return implementation.isStopping();
×
289
                } else {
290
                        return super.isStopping();
×
291
                }
292
        }
293
        
294
        @Override
295
        public void initialize() {
296
                if (implementation != null) {
×
297
                        implementation.initialize();
×
298
                } else {
299
                        super.initialize();
×
300
                }
301
        }
×
302
        
303
        @Override
304
        public void stop() {
305
                if (implementation != null) {
×
306
                        implementation.stop();
×
307
                } else {
308
                        super.stop();
×
309
                }
310
        }
×
311
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc