summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/certsrv/logging/ILogger.java
blob: b4a7070a7655c520645ea714644a591d94f402dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 2 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// (C) 2007 Red Hat, Inc.
// All rights reserved.
// --- END COPYRIGHT BLOCK ---
package com.netscape.certsrv.logging;


import java.util.*;
import com.netscape.certsrv.common.*;


/**
 * An interface represents a logger for certificate server. This object is used to
 * issue log messages for the various types of logging event types.  A log message results
 * in a  ILogEvent being created.  This event is then placed on a ILogQueue to be ultimately
 * written to the destination log file.  This object also maintains a collection of ILogFactory objects
 * which are used to create the supported types of ILogEvents. CMS comes out of the box with three event
 * types:  "signedAudit", "system", and "audit".
 *
 * @version $Revision$, $Date$
 */
public interface ILogger {
    
    //List of defined log classes.
    /**
     * log class: audit event.
     */
    public static final int EV_AUDIT = 0;
    public static final String PROP_AUDIT = "transaction";

    /**
     * log class: system event. 
     * System event with log level >= LL_FAILURE will also be logged in error log
     */
    public static final int EV_SYSTEM = 1;
    public static final String PROP_SYSTEM = "system";

    /**
     * log class: SignedAudit event. 
     */
    public static final int EV_SIGNED_AUDIT = 2;
    public static final String PROP_SIGNED_AUDIT = "signedAudit";

    //List of defined log sources.
	
    /**
     * log source: used by servlet to retrieve all logs
     */
    public static final int S_ALL = 0; //used by servlet only

    /**
     * log source: identify the log entry is from KRA
     */
    public static final int S_KRA = 1;

    /**
     * log source: identify the log entry is from RA
     */
    public static final int S_RA = 2;

    /**
     * log source: identify the log entry is from CA
     */
    public static final int S_CA = 3;

    /**
     * log source: identify the log entry is from http subsystem
     */
    public static final int S_HTTP = 4;

    /**
     * log source: identify the log entry is from database subsystem
     */
    public static final int S_DB = 5;

    /**
     * log source: identify the log entry is from authentication subsystem
     */
    public static final int S_AUTHENTICATION = 6;

    /**
     * log source: identify the log entry is from admin subsystem
     */
    public static final int S_ADMIN = 7;

    /**
     * log source: identify the log entry is from ldap subsystem
     */
    public static final int S_LDAP = 8;

    /**
     * log source: identify the log entry is from request queue subsystem
     */
    public static final int S_REQQUEUE = 9;

    /**
     * log source: identify the log entry is from acl subsystem
     */
    public static final int S_ACLS = 10;

    /**
     * log source: identify the log entry is from usergrp subsystem
     */
    public static final int S_USRGRP = 11;
    public static final int S_OCSP = 12;

    /**
     * log source: identify the log entry is from authorization subsystem
     */
    public static final int S_AUTHORIZATION = 13;

    /**
     * log source: identify the log entry is from signed audit
     */
    public static final int S_SIGNED_AUDIT = 14;

    /**
     * log source: identify the log entry is from CrossCertPair subsystem
     */
    public static final int S_XCERT = 15;

    /**
     * log source: identify the log entry is from CrossCertPair subsystem
     */

    public static final int S_TKS = 16;
    
    /**
     * log source: identify the log entry is from other subsystem
     * eg. policy, security, connector,registration
     */
    public static final int S_OTHER = 20;


    // List of defined log levels.
    /**
     * log level: used by servlet to retrieve all level logs
     */
    public static final int LL_ALL = -1; //used by servlet only
    public static final String LL_ALL_STRING = "All"; //used by servlet only

    /**
     * log level: indicate this log entry is debug info
     */
    
    /**
     * Debug level is depreciated since CMS6.1. Please use
     * CMS.debug() to output messages to debugging file.
     */
    public static final int LL_DEBUG = 0;  // depreciated
    public static final String LL_DEBUG_STRING = "Debug";

    /**
     * log level: indicate this log entry is for info note
     */
    public static final int LL_INFO = 1;
    public static final String LL_INFO_STRING = "Information";

    /**
     * log level: indicate this log entry is warning info
     */
    public static final int LL_WARN = 2;
    public static final String LL_WARN_STRING = "Warning";

    /**
     * log level: indicate this log entry is fail/error info
     */
    public static final int LL_FAILURE = 3;
    public static final String LL_FAILURE_STRING = "Failure";

    /**
     * log level: indicate this log entry is about misconfiguration
     */
    public static final int LL_MISCONF = 4;
    public static final String LL_MISCONF_STRING = "Misconfiguration";

    /**
     * log level: indicate this log entry is catastrphe info
     */
    public static final int LL_CATASTRPHE = 5;
    public static final String LL_CATASTRPHE_STRING = "Catastrophe";

    /**
     * log level: indicate this log entry is security info
     */
    public static final int LL_SECURITY = 6;
    public static final String LL_SECURITY_STRING = "Security";

    /**
     * "SubjectID" for system-initiated events logged
     * in signed audit log messages
     */
    public static final String SYSTEM_UID = "$System$";

    /**
     * A constant string value used to denote a single "unknown" identity
     * in signed audit log messages
     */
    public static final String UNIDENTIFIED = "$Unidentified$";

    /**
     * A constant string value used to denote a single "non-role" identity
     * in signed audit log messages
     */
    public static final String NONROLEUSER = "$NonRoleUser$";

    /**
     * "Outcome" for events logged in signed audit log messages
     */
    public static final String SUCCESS = "Success";
    public static final String FAILURE = "Failure";
    
    /**
     * A constant string value used to denote a "non-applicable"
     * data value in signed audit log messages
     */
    public final static String SIGNED_AUDIT_NON_APPLICABLE = "N/A";

    /**
     * A constant string value used to denote an "empty", or "null",
     * data value in signed audit log messages
     */
    public final static String SIGNED_AUDIT_EMPTY_VALUE = "<null>";

    /**
     * Constant string values associated with the type of certificate
     * processing stored in the "InfoName" field in certain signed
     * audit log messages
     */
    public final static String SIGNED_AUDIT_ACCEPTANCE = "certificate";
    public final static String SIGNED_AUDIT_CANCELLATION = "cancelReason";
    public final static String SIGNED_AUDIT_REJECTION = "rejectReason";

    // List of all NT event type
    /**
     * NT event type: correspond to log level LL_DEBUG or LL_INFO
     */
    public static final int NT_INFO = 4;

    /**
     * NT event type: correspond to log level LL_WARNING
     */
    public static final int NT_WARN = 2;

    /**
     * NT event type: correspont to log level LL_FAILURE and above
     */
    public static final int NT_ERROR = 1;
    
    // List of defined log multiline attribute.
    /**
     * indicate the log message has more than one line
     */
    public static final boolean L_MULTILINE = true;

    /**
     * indicate the log message has one line
     */
    public static final boolean L_SINGLELINE = false;

    /**
     * Logs an event to the log queue.
     *
     * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM or EV_SIGNED_AUDIT.
     * @param source The source of the log event.
     * @param msg The detail message to be logged.
     */
    public void log(int evtClass, int source, String msg);

    /**
     * Logs an event to the log queue.
     *
     * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM or EV_SIGNED_AUDIT.
     * @param props The resource bundle used for the detailed message.
     * @param source The source of the log event.
     * @param msg The detail message to be logged.
     */
    public void log(int evtClass, Properties props, int source, String msg);

    /**
     * Logs an event to the log queue.
     *
     * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM or EV_SIGNED_AUDIT.
     * @param source The source of the log event.
     * @param level The level of the log event.
     * @param msg The detail message to be logged.
     */
    public void log(int evtClass, int source, int level, String msg);

    /**
     * Logs an event to the log queue.
     *
     * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM or EV_SIGNED_AUDIT.
     * @param props The resource bundle used for the detailed message.
     * @param source The source of the log event.
     * @param level The level of the log event.
     * @param msg The detail message to be logged.
     */
    public void log(int evtClass, Properties props, int source, int level, String msg);

    /**
     * Logs an event to the log queue.
     *
     * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM or EV_SIGNED_AUDIT.
     * @param source The source of the log event.
     * @param level The level of the log event.
     * @param msg The detail message to be logged.
     * @param param The parameter in the detail message.
     */
    public void log(int evtClass, int source, int level, String msg, Object param);

    /**
     * Logs an event to the log queue.
     *
     * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM or EV_SIGNED_AUDIT.
     * @param source The source of the log event.
     * @param level The level of the log event.
     * @param msg The detail message to be logged.
     * @param params The parameters in the detail message.
     */
    public void log(int evtClass, int source, int level, String msg, Object params[]);

    /**
     * Logs an event to the log queue.
     *
     * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM or EV_SIGNED_AUDIT.
     * @param props The resource bundle used for the detailed message.
     * @param source The source of the log event.
     * @param msg The detail message to be logged.
     * @param param The parameters in the detail message.
     */
    public void log(int evtClass, Properties props, int source, String msg, Object param);

    /**
     * Logs an event to the log queue.
     *
     * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM or EV_SIGNED_AUDIT.
     * @param props The resource bundle used for the detailed message.
     * @param source The source of the log event.
     * @param level The level of the log event.
     * @param msg The detail message to be logged.
     * @param param The parameter in the detail message.
     */
    public void log(int evtClass, Properties props, int source, int level, String msg,
        Object param);

    /**
     * Logs an event to the log queue.
     *
     * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM or EV_SIGNED_AUDIT.
     * @param prop The resource bundle used for the detailed message.
     * @param source The source of the log event.
     * @param level The level of the log event.
     * @param msg The detail message to be logged.
     * @param params The parameters in the detail message.
     */
    public void log(int evtClass, Properties prop, int source, int level, String msg,
        Object params[]);

    //multiline log

    /**
     * Logs an event to the log queue.
     *
     * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM or EV_SIGNED_AUDIT.
     * @param source The source of the log event.
     * @param msg The detail message to be logged.
     * @param multiline true If the message has more than one line, otherwise false.
     */
    public void log(int evtClass, int source, String msg, boolean multiline);

    /**
     * Logs an event to the log queue.
     *
     * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM or EV_SIGNED_AUDIT.
     * @param props The resource bundle used for the detailed message.
     * @param source The source of the log event.
     * @param msg The detail message to be logged.
     * @param multiline True if the message has more than one line, otherwise false.
     */
    public void log(int evtClass, Properties props, int source, String msg, boolean multiline);

    /**
     * Logs an event to the log queue.
     *
     * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM or EV_SIGNED_AUDIT.
     * @param source The source of the log event.
     * @param level The level of the log event.
     * @param msg The detail message to be logged.
     * @param multiline True if the message has more than one line, otherwise false.
     */
    public void log(int evtClass, int source, int level, String msg, boolean multiline);

    /**
     * Logs an event to the log queue.
     *
     * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM or EV_SIGNED_AUDIT.
     * @param props The resource bundle used for the detailed message.
     * @param source The source of the log event.
     * @param level The level of the log event.
     * @param msg The detail message to be logged.
     * @param multiline True if the message has more than one line, otherwise false.
     */
    public void log(int evtClass, Properties props, int source, int level, String msg, boolean multiline);

    /**
     * Logs an event to the log queue.
     *
     * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM or EV_SIGNED_AUDIT.
     * @param source The source of the log event.
     * @param level The level of the log event.
     * @param msg The detail message to be logged.
     * @param param The parameter in the detail message.
     * @param multiline True if the message has more than one line, otherwise false.
     */
    public void log(int evtClass, int source, int level, String msg, Object param, boolean multiline);

    /**
     * Logs an event to the log queue.
     *
     * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM or EV_SIGNED_AUDIT.
     * @param props The resource bundle used for the detailed message.
     * @param source TTTTsource of the log event.
     * @param msg The detail message to be logged.
     * @param param The parameter in the detail message.
     * @param multiline True if the message has more than one line, otherwise false.
     */
    public void log(int evtClass, Properties props, int source, String msg, Object param, boolean multiline);

    /**
     * Logs an event to the log queue.
     *
     * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM or EV_SIGNED_AUDIT.
     * @param props The resource bundle used for the detailed message.
     * @param source The source of the log event.
     * @param level The level of the log event.
     * @param msg The detail message to be logged.
     * @param param The parameter in the detail message.
     * @param multiline True if the message has more than one line, otherwise false.
     */
    public void log(int evtClass, Properties props, int source, int level, String msg,
        Object param, boolean multiline);

    /**
     * Logs an event to the log queue.
     *
     * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM or EV_SIGNED_AUDIT.
     * @param prop The resource bundle used for the detailed message.
     * @param source The source of the log event.
     * @param level The level of the log event.
     * @param msg The detail message to be logged.
     * @param params The parameters in the detail message.
     * @param multiline True if the message has more than one line, otherwise false.
     */
    public void log(int evtClass, Properties prop, int source, int level, String msg,
        Object params[], boolean multiline);

    /*
     * Generates an ILogEvent
     * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM or EV_SIGNED_AUDIT.
     * @param props The resource bundle used for the detailed message.
     * @param source The source of the log event.
     * @param level The level of the log event.
     * @param msg The detail message to be logged.
     * @param params The parameters in the detail message.
     * @param multiline True if the message has more than one line, otherwise false.
     * @return ILogEvent, a log event.
     */
    public ILogEvent create(int evtClass, Properties prop, int source, int level,
        String msg, Object params[], boolean multiline);

    /**
     * Register a log event factory. Which will create the desired ILogEvents.
     */
    public void register(int evtClass, ILogEventFactory f);

    /**
     * Retrieves the associated log queue.  The log queue is where issued log events
     * are collected for later processing.
     */
    public ILogQueue getLogQueue();

}