diff options
Diffstat (limited to 'pki/base/common/src/com/netscape/cmscore/logging')
8 files changed, 222 insertions, 210 deletions
diff --git a/pki/base/common/src/com/netscape/cmscore/logging/AuditEventFactory.java b/pki/base/common/src/com/netscape/cmscore/logging/AuditEventFactory.java index 438b3abb..46b42f04 100644 --- a/pki/base/common/src/com/netscape/cmscore/logging/AuditEventFactory.java +++ b/pki/base/common/src/com/netscape/cmscore/logging/AuditEventFactory.java @@ -17,6 +17,7 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cmscore.logging; + import java.util.Properties; import com.netscape.certsrv.logging.AuditEvent; @@ -25,11 +26,12 @@ import com.netscape.certsrv.logging.ILogEvent; import com.netscape.certsrv.logging.ILogEventFactory; import com.netscape.certsrv.logging.ILogger; + /** * A log event object for handling audit messages * <P> - * - * @author mikep + * + * @author mikep * @author mzhao * @version $Revision$, $Date$ */ @@ -58,7 +60,7 @@ public class AuditEventFactory implements ILogEventFactory { * @param params the parameters in the detail log message */ public ILogEvent create(int evtClass, Properties prop, int source, - int level, boolean multiline, String msg, Object params[]) { + int level, boolean multiline, String msg, Object params[]) { if (evtClass != ILogger.EV_AUDIT) return null; AuditEvent event = new AuditEvent(msg, params); @@ -72,8 +74,8 @@ public class AuditEventFactory implements ILogEventFactory { /** * Set the resource bundle of the log event. - * - * @param prop the properties + * + * @param prop the properties * @param event the log event */ protected void setProperties(Properties prop, IBundleLogEvent event) { @@ -90,7 +92,7 @@ public class AuditEventFactory implements ILogEventFactory { /** * Releases an log event. - * + * * @param e the log event */ public void release(ILogEvent e) { diff --git a/pki/base/common/src/com/netscape/cmscore/logging/AuditFormat.java b/pki/base/common/src/com/netscape/cmscore/logging/AuditFormat.java index d9279997..7d7f817f 100644 --- a/pki/base/common/src/com/netscape/cmscore/logging/AuditFormat.java +++ b/pki/base/common/src/com/netscape/cmscore/logging/AuditFormat.java @@ -17,12 +17,14 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cmscore.logging; + import com.netscape.certsrv.logging.ILogger; import com.netscape.certsrv.request.IRequest; + /** * Define audit log message format - * + * * @author mzhao * @version $Revision$, $Date$ */ @@ -41,54 +43,68 @@ public class AuditFormat { /** * initiative: the event is from agent */ - public static final String FROMAGENT = "fromAgent"; + public static final String FROMAGENT = "fromAgent"; /** * initiative: the event is from router */ - public static final String FROMROUTER = "fromRouter"; + public static final String FROMROUTER = "fromRouter"; /** * initiative: the event is from remote authority */ public static final String FROMRA = "fromRemoteAuthority"; - + /** * authentication module: no Authentication manager */ public static final String NOAUTH = "noAuthManager"; // for ProcessCertReq.java ,kra - /* - * 0: request type 1: request ID 2: initiative 3: auth module 4: status 5: - * cert dn 6: other info. eg cert serial number, violation policies + /* 0: request type + 1: request ID + 2: initiative + 3: auth module + 4: status + 5: cert dn + 6: other info. eg cert serial number, violation policies */ - public static final String FORMAT = "{0} reqID {1} {2} authenticated by {3} is {4} DN requested: {5} {6}"; - public static final String NODNFORMAT = "{0} reqID {1} {2} authenticated by {3} is {4}"; + public static final String FORMAT = + "{0} reqID {1} {2} authenticated by {3} is {4} DN requested: {5} {6}"; + public static final String NODNFORMAT = + "{0} reqID {1} {2} authenticated by {3} is {4}"; - public static final String ENROLLMENTFORMAT = IRequest.ENROLLMENT_REQUEST - + " reqID {0} {1} authenticated by {2} is {3}. DN requested: {4} {5}"; - public static final String RENEWALFORMAT = IRequest.RENEWAL_REQUEST - + " reqID {0} {1} authenticated by {2} is {3}. DN requested: {4} old serial number: 0x{5} {6}"; - public static final String REVOCATIONFORMAT = IRequest.REVOCATION_REQUEST - + " reqID {0} {1} authenticated by {2} is {3}. DN requested: {4} serial number: 0x{5} revocation reason: {6} {7}"; + public static final String ENROLLMENTFORMAT = + IRequest.ENROLLMENT_REQUEST + " reqID {0} {1} authenticated by {2} is {3}. DN requested: {4} {5}"; + public static final String RENEWALFORMAT = + IRequest.RENEWAL_REQUEST + " reqID {0} {1} authenticated by {2} is {3}. DN requested: {4} old serial number: 0x{5} {6}"; + public static final String REVOCATIONFORMAT = + IRequest.REVOCATION_REQUEST + " reqID {0} {1} authenticated by {2} is {3}. DN requested: {4} serial number: 0x{5} revocation reason: {6} {7}"; // 1: fromAgent AgentID: xxx authenticated by xxx - public static final String DOREVOKEFORMAT = IRequest.REVOCATION_REQUEST - + " reqID {0} {1} is {2}. DN requested: {3} serial number: 0x{4} revocation reason: {5}"; + public static final String DOREVOKEFORMAT = + IRequest.REVOCATION_REQUEST + " reqID {0} {1} is {2}. DN requested: {3} serial number: 0x{4} revocation reason: {5}"; // 1: fromAgent AgentID: xxx authenticated by xxx - public static final String DOUNREVOKEFORMAT = IRequest.UNREVOCATION_REQUEST - + " reqID {0} {1} is {2}. DN requested: {3} serial number: 0x{4}"; + public static final String DOUNREVOKEFORMAT = + IRequest.UNREVOCATION_REQUEST + " reqID {0} {1} is {2}. DN requested: {3} serial number: 0x{4}"; // 0:initiative - public static final String CRLUPDATEFORMAT = "CRLUpdate request {0} authenticated by {1} is {2}. Id: {3}\ncrl Number: {4} last update time: {5} next update time: {6} number of entries in the CRL: {7}"; + public static final String CRLUPDATEFORMAT = + "CRLUpdate request {0} authenticated by {1} is {2}. Id: {3}\ncrl Number: {4} last update time: {5} next update time: {6} number of entries in the CRL: {7}"; // audit user/group - public static final String ADDUSERFORMAT = "Admin UID: {0} added User UID: {1}"; - public static final String REMOVEUSERFORMAT = "Admin UID: {0} removed User UID: {1} "; - public static final String MODIFYUSERFORMAT = "Admin UID: {0} modified User UID: {1}"; - public static final String ADDUSERCERTFORMAT = "Admin UID: {0} added cert for User UID: {1}. cert DN: {2} serial number: 0x{3}"; - public static final String REMOVEUSERCERTFORMAT = "Admin UID: {0} removed cert of User UID: {1}. cert DN: {2} serial number: 0x{3}"; - public static final String ADDUSERGROUPFORMAT = "Admin UID: {0} added User UID: {1} to group: {2}"; - public static final String REMOVEUSERGROUPFORMAT = "Admin UID: {0} removed User UID: {1} from group: {2}"; + public static final String ADDUSERFORMAT = + "Admin UID: {0} added User UID: {1}"; + public static final String REMOVEUSERFORMAT = + "Admin UID: {0} removed User UID: {1} "; + public static final String MODIFYUSERFORMAT = + "Admin UID: {0} modified User UID: {1}"; + public static final String ADDUSERCERTFORMAT = + "Admin UID: {0} added cert for User UID: {1}. cert DN: {2} serial number: 0x{3}"; + public static final String REMOVEUSERCERTFORMAT = + "Admin UID: {0} removed cert of User UID: {1}. cert DN: {2} serial number: 0x{3}"; + public static final String ADDUSERGROUPFORMAT = + "Admin UID: {0} added User UID: {1} to group: {2}"; + public static final String REMOVEUSERGROUPFORMAT = + "Admin UID: {0} removed User UID: {1} from group: {2}"; } diff --git a/pki/base/common/src/com/netscape/cmscore/logging/LogQueue.java b/pki/base/common/src/com/netscape/cmscore/logging/LogQueue.java index ce6c159b..faddc44d 100644 --- a/pki/base/common/src/com/netscape/cmscore/logging/LogQueue.java +++ b/pki/base/common/src/com/netscape/cmscore/logging/LogQueue.java @@ -17,6 +17,7 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cmscore.logging; + import java.util.Vector; import com.netscape.certsrv.logging.ELogException; @@ -24,8 +25,9 @@ import com.netscape.certsrv.logging.ILogEvent; import com.netscape.certsrv.logging.ILogEventListener; import com.netscape.certsrv.logging.ILogQueue; + /** - * A class represents a log queue. + * A class represents a log queue. * <P> * * @author mzhao @@ -49,11 +51,11 @@ public class LogQueue implements ILogQueue { /** * Initializes the log queue. * <P> - * + * */ public void init() { mListeners = new Vector(); - + } /** @@ -61,7 +63,7 @@ public class LogQueue implements ILogQueue { * <P> */ public void shutdown() { - if (mListeners == null) + if (mListeners == null) return; for (int i = 0; i < mListeners.size(); i++) { ((ILogEventListener) mListeners.elementAt(i)).shutdown(); @@ -71,18 +73,18 @@ public class LogQueue implements ILogQueue { /** * Adds an event listener. - * + * * @param listener the log event listener */ public void addLogEventListener(ILogEventListener listener) { - // Make sure we don't have duplicated listener + //Make sure we don't have duplicated listener if (!mListeners.contains(listener)) mListeners.addElement(listener); } /** * Removes an event listener. - * + * * @param listener the log event listener */ public void removeLogEventListener(ILogEventListener listener) { @@ -91,31 +93,30 @@ public class LogQueue implements ILogQueue { /** * Logs an event, and notifies logger to reuse the event. - * + * * @param event the log event */ public void log(ILogEvent event) { if (mListeners == null) - return; + return; for (int i = 0; i < mListeners.size(); i++) { try { ((ILogEventListener) mListeners.elementAt(i)).log(event); } catch (ELogException e) { - // Raidzilla Bug #57592: Don't display potentially - // incorrect log message. - // ConsoleError.send(new - // SystemEvent(CMS.getUserMessage("CMS_LOG_EVENT_FAILED", - // event.getEventType(), e.toString()))); - - // Don't do this again. - removeLogEventListener((ILogEventListener) mListeners - .elementAt(i)); + // Raidzilla Bug #57592: Don't display potentially + // incorrect log message. + // ConsoleError.send(new SystemEvent(CMS.getUserMessage("CMS_LOG_EVENT_FAILED", + // event.getEventType(), e.toString()))); + + // Don't do this again. + removeLogEventListener((ILogEventListener) + mListeners.elementAt(i)); } } } /** - * Flushes the log buffers (if any) + * Flushes the log buffers (if any) */ public void flush() { for (int i = 0; i < mListeners.size(); i++) { @@ -123,3 +124,4 @@ public class LogQueue implements ILogQueue { } } } + diff --git a/pki/base/common/src/com/netscape/cmscore/logging/LogSubsystem.java b/pki/base/common/src/com/netscape/cmscore/logging/LogSubsystem.java index f75d24bd..eeae860c 100644 --- a/pki/base/common/src/com/netscape/cmscore/logging/LogSubsystem.java +++ b/pki/base/common/src/com/netscape/cmscore/logging/LogSubsystem.java @@ -17,6 +17,7 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cmscore.logging; + import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; @@ -32,6 +33,7 @@ import com.netscape.certsrv.logging.ILogSubsystem; import com.netscape.certsrv.logging.LogPlugin; import com.netscape.cmscore.util.Debug; + /** * A class represents a log subsystem. * <P> @@ -69,19 +71,18 @@ public class LogSubsystem implements ILogSubsystem { } public void setId(String id) throws EBaseException { - throw new EBaseException( - CMS.getUserMessage("CMS_BASE_INVALID_OPERATION")); + throw new EBaseException(CMS.getUserMessage("CMS_BASE_INVALID_OPERATION")); } /** * Initializes the log subsystem. * <P> - * + * * @param owner owner of this subsystem * @param config configuration store */ public void init(ISubsystem owner, IConfigStore config) - throws EBaseException { + throws EBaseException { mConfig = config; mLogQueue.init(); @@ -99,16 +100,18 @@ public class LogSubsystem implements ILogSubsystem { if (Debug.ON) Debug.trace("loaded logger plugins"); - // load log instances + // load log instances c = config.getSubStore(PROP_INSTANCE); Enumeration instances = c.getSubStoreNames(); while (instances.hasMoreElements()) { String insName = (String) instances.nextElement(); - String implName = c.getString(insName + "." + PROP_PLUGIN); - LogPlugin plugin = (LogPlugin) mLogPlugins.get(implName); + String implName = c.getString(insName + "." + + PROP_PLUGIN); + LogPlugin plugin = + (LogPlugin) mLogPlugins.get(implName); - if (plugin == null) { + if (plugin == null) { throw new EBaseException(implName); } String className = plugin.getClassPath(); @@ -116,9 +119,10 @@ public class LogSubsystem implements ILogSubsystem { ILogEventListener logInst = null; try { - logInst = (ILogEventListener) Class.forName(className) - .newInstance(); - IConfigStore pConfig = c.getSubStore(insName); + logInst = (ILogEventListener) + Class.forName(className).newInstance(); + IConfigStore pConfig = + c.getSubStore(insName); logInst.init(this, pConfig); // for view from console @@ -126,35 +130,28 @@ public class LogSubsystem implements ILogSubsystem { } catch (ClassNotFoundException e) { String errMsg = "LogSubsystem:: init()-" + e.toString(); - throw new EBaseException(insName - + ":Failed to instantiate class " + className); + throw new EBaseException(insName + ":Failed to instantiate class " + className); } catch (IllegalAccessException e) { String errMsg = "LogSubsystem:: init()-" + e.toString(); - throw new EBaseException(insName - + ":Failed to instantiate class " + className); + throw new EBaseException(insName + ":Failed to instantiate class " + className); } catch (InstantiationException e) { String errMsg = "LogSubsystem:: init()-" + e.toString(); - throw new EBaseException(insName - + ":Failed to instantiate class " + className); + throw new EBaseException(insName + ":Failed to instantiate class " + className); } catch (Throwable e) { e.printStackTrace(); - throw new EBaseException(insName - + ":Failed to instantiate class " + className - + " error: " + e.getMessage()); + throw new EBaseException(insName + ":Failed to instantiate class " + className + " error: " + e.getMessage()); } if (insName == null) { - throw new EBaseException("Failed to instantiate class " - + insName); + throw new EBaseException("Failed to instantiate class " + insName); } // add log instance to list. mLogInsts.put(insName, logInst); if (Debug.ON) - Debug.trace("loaded log instance " + insName + " impl " - + implName); + Debug.trace("loaded log instance " + insName + " impl " + implName); } } @@ -166,10 +163,9 @@ public class LogSubsystem implements ILogSubsystem { while (enum1.hasMoreElements()) { String instName = (String) enum1.nextElement(); - Debug.trace("about to call inst=" + instName - + " in LogSubsystem.startup()"); - ILogEventListener inst = (ILogEventListener) mLogInsts - .get(instName); + Debug.trace("about to call inst=" + instName + " in LogSubsystem.startup()"); + ILogEventListener inst = (ILogEventListener) + mLogInsts.get(instName); inst.startup(); } @@ -186,7 +182,7 @@ public class LogSubsystem implements ILogSubsystem { /** * Returns the root configuration storage of this system. * <P> - * + * * @return configuration store of this subsystem */ public IConfigStore getConfigStore() { @@ -232,37 +228,40 @@ public class LogSubsystem implements ILogSubsystem { return mLogInsts; } - public Vector getLogDefaultParams(String implName) throws ELogException { + public Vector getLogDefaultParams(String implName) throws + ELogException { // is this a registered implname? - LogPlugin plugin = (LogPlugin) mLogPlugins.get(implName); + LogPlugin plugin = (LogPlugin) + mLogPlugins.get(implName); if (plugin == null) { throw new ELogException(implName); } - + // a temporary instance ILogEventListener LogInst = null; String className = plugin.getClassPath(); try { - LogInst = (ILogEventListener) Class.forName(className) - .newInstance(); + LogInst = (ILogEventListener) + Class.forName(className).newInstance(); Vector v = LogInst.getDefaultParams(); return v; } catch (InstantiationException e) { - throw new ELogException(CMS.getUserMessage( - "CMS_LOG_LOAD_CLASS_FAIL", className)); + throw new ELogException( + CMS.getUserMessage("CMS_LOG_LOAD_CLASS_FAIL", className)); } catch (ClassNotFoundException e) { - throw new ELogException(CMS.getUserMessage( - "CMS_LOG_LOAD_CLASS_FAIL", className)); + throw new ELogException( + CMS.getUserMessage("CMS_LOG_LOAD_CLASS_FAIL", className)); } catch (IllegalAccessException e) { - throw new ELogException(CMS.getUserMessage( - "CMS_LOG_LOAD_CLASS_FAIL", className)); + throw new ELogException( + CMS.getUserMessage("CMS_LOG_LOAD_CLASS_FAIL", className)); } } - public Vector getLogInstanceParams(String insName) throws ELogException { + public Vector getLogInstanceParams(String insName) throws + ELogException { ILogEventListener logInst = getLogInstance(insName); if (logInst == null) { @@ -273,3 +272,4 @@ public class LogSubsystem implements ILogSubsystem { return v; } } + diff --git a/pki/base/common/src/com/netscape/cmscore/logging/Logger.java b/pki/base/common/src/com/netscape/cmscore/logging/Logger.java index 129dfd71..3c97023a 100644 --- a/pki/base/common/src/com/netscape/cmscore/logging/Logger.java +++ b/pki/base/common/src/com/netscape/cmscore/logging/Logger.java @@ -17,6 +17,7 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cmscore.logging; + import java.util.Hashtable; import java.util.Properties; @@ -25,11 +26,13 @@ import com.netscape.certsrv.logging.ILogEventFactory; import com.netscape.certsrv.logging.ILogQueue; import com.netscape.certsrv.logging.ILogger; + /** - * A class represents certificate server logger implementation. + * A class represents certificate server logger + * implementation. * <P> - * - * @author thomask + * + * @author thomask * @author mzhao * @version $Revision$, $Date$ */ @@ -40,8 +43,8 @@ public class Logger implements ILogger { protected Hashtable mFactories = new Hashtable(); /** - * Constructs a generic logger, and registers a list of resident event - * factories. + * Constructs a generic logger, and registers a list + * of resident event factories. */ public Logger() { mLogQueue = LogSubsystem.getLogQueue(); @@ -60,7 +63,7 @@ public class Logger implements ILogger { } /** - * Retrieves the associated log queue. + * Retrieves the associated log queue. */ public ILogQueue getLogQueue() { return mLogQueue; @@ -68,19 +71,17 @@ public class Logger implements ILogger { /** * Registers log factory. - * - * @param evtClass the event class name: ILogger.EV_SYSTEM or - * ILogger.EV_AUDIT + * @param evtClass the event class name: ILogger.EV_SYSTEM or ILogger.EV_AUDIT * @param f the event factory name */ public void register(int evtClass, ILogEventFactory f) { mFactories.put(Integer.toString(evtClass), f); } - // ************** default level **************** + //************** default level **************** /** * Logs an event using default log level: ILogger.LL_INFO - * + * * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM. * @param source the source of the log event * @param msg the one line detail message to be logged @@ -91,7 +92,7 @@ public class Logger implements ILogger { /** * Logs an event using default log level: ILogger.LL_INFO - * + * * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM. * @param props the resource bundle used for the detailed message * @param source the source of the log event @@ -101,11 +102,11 @@ public class Logger implements ILogger { log(evtClass, props, source, ILogger.LL_INFO, msg, null); } - // ************** no param **************** + //************** no param **************** /** * Logs an event to the log queue. - * + * * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM. * @param source the source of the log event * @param level the level of the log event @@ -117,51 +118,48 @@ public class Logger implements ILogger { /** * Logs an event to the log queue. - * + * * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM. * @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 one line detail message to be logged */ - public void log(int evtClass, Properties props, int source, int level, - String msg) { + public void log(int evtClass, Properties props, int source, int level, String msg) { log(evtClass, props, source, level, msg, null); } - // ********************* one param ********************** + //********************* one param ********************** /** * Logs an event to the log queue. - * + * * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM. * @param props the resource bundle used for the detailed message * @param source the source of the log event * @param msg the one line 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) { + public void log(int evtClass, int source, int level, String msg, Object param) { log(evtClass, null, source, level, msg, param); } /** * Logs an event using default log level: ILogger.LL_INFO - * + * * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM. * @param props the resource bundle used for the detailed message * @param source the source of the log event * @param msg the one line detail message to be logged * @param param the parameter in the detail message */ - public void log(int evtClass, Properties props, int source, String msg, - Object param) { + public void log(int evtClass, Properties props, int source, String msg, Object param) { log(evtClass, props, source, ILogger.LL_INFO, msg, param); } /** * Logs an event to the log queue. - * + * * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM. * @param props the resource bundle used for the detailed message * @param source the source of the log event @@ -169,19 +167,19 @@ public class Logger implements ILogger { * @param msg the one line 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) { + public void log(int evtClass, Properties props, int source, int level, String msg, + Object param) { Object o[] = new Object[1]; o[0] = param; log(evtClass, props, source, level, msg, o); } - // ******************* multiple param ************************** + //******************* multiple param ************************** /** * Logs an event to the log queue. - * + * * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM. * @param source the source of the log event * @param level the level of the log event @@ -189,14 +187,14 @@ public class Logger implements ILogger { * @param params the parameters in the detail message */ public void log(int evtClass, int source, int level, String msg, - Object params[]) { + Object params[]) { log(evtClass, null, source, level, msg, params); } - // *************** the real implementation ***************** + //*************** the real implementation ***************** /** * Logs an event to the log queue. - * + * * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM. * @param props the resource bundle used for the detailed message * @param source the source of the log event @@ -204,22 +202,20 @@ public class Logger implements ILogger { * @param msg the one line 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[]) { - mLogQueue.log(create(evtClass, prop, source, level, msg, params, - ILogger.L_SINGLELINE)); + public void log(int evtClass, Properties prop, int source, int level, String msg, + Object params[]) { + mLogQueue.log(create(evtClass, prop, source, level, msg, params, ILogger.L_SINGLELINE)); } - // ******************** multiline log ************************* - // ************** default level **************** + //******************** multiline log ************************* + //************** default level **************** /** * Logs an event using default log level: ILogger.LL_INFO - * + * * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM. * @param source the source of the log event * @param msg the one line detail message to be logged - * @param multiline true if the message has more than one line, otherwise - * false + * @param multiline true if the message has more than one line, otherwise false */ public void log(int evtClass, int source, String msg, boolean multiline) { log(evtClass, null, source, ILogger.LL_INFO, msg, null, multiline); @@ -227,153 +223,141 @@ public class Logger implements ILogger { /** * Logs an event using default log level: ILogger.LL_INFO - * + * * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM. * @param props the resource bundle used for the detailed message * @param source the source of the log event * @param msg the one line detail message to be logged - * @param multiline true if the message has more than one line, otherwise - * false + * @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) { + public void log(int evtClass, Properties props, int source, String msg, boolean multiline) { log(evtClass, props, source, ILogger.LL_INFO, msg, null, multiline); } - // ************** no param **************** + //************** no param **************** /** * Logs an event to the log queue. - * + * * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM. * @param source the source of the log event * @param level the level of the log event * @param msg the one line detail message to be logged - * @param multiline true if the message has more than one line, otherwise - * false + * @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) { + public void log(int evtClass, int source, int level, String msg, boolean multiline) { log(evtClass, null, source, level, msg, null, multiline); } /** * Logs an event to the log queue. - * + * * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM. * @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 one line detail message to be logged - * @param multiline true if the message has more than one line, otherwise - * false + * @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) { + public void log(int evtClass, Properties props, int source, int level, String msg, boolean multiline) { log(evtClass, props, source, level, msg, null, multiline); } - // ********************* one param ********************** + //********************* one param ********************** /** * Logs an event to the log queue. - * + * * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM. * @param props the resource bundle used for the detailed message * @param source the source of the log event * @param msg the one line 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 + * @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) { + public void log(int evtClass, int source, int level, String msg, Object param, boolean multiline) { log(evtClass, null, source, level, msg, param, multiline); } /** * Logs an event using default log level: ILogger.LL_INFO - * + * * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM. * @param props the resource bundle used for the detailed message * @param source the source of the log event * @param msg the one line 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 + * @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) { + public void log(int evtClass, Properties props, int source, String msg, Object param, boolean multiline) { log(evtClass, props, source, ILogger.LL_INFO, msg, param, multiline); } /** * Logs an event to the log queue. - * + * * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM. * @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 one line 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 + * @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) { + public void log(int evtClass, Properties props, int source, int level, String msg, + Object param, boolean multiline) { Object o[] = new Object[1]; o[0] = param; log(evtClass, props, source, level, msg, o, multiline); } - // ******************* multiple param ************************** + //******************* multiple param ************************** /** * Logs an event to the log queue. - * + * * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM. * @param source the source of the log event * @param level the level of the log event * @param msg the one line 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 + * @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 params[], boolean multiline) { + Object params[], boolean multiline) { log(evtClass, null, source, level, msg, params, multiline); } - // *************** the real implementation ***************** + //*************** the real implementation ***************** /** * Logs an event to the log queue. - * + * * @param evtClass What kind of event it is: EV_AUDIT or EV_SYSTEM. * @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 one line 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 + * @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) { - mLogQueue.log(create(evtClass, prop, source, level, msg, params, - multiline)); + public void log(int evtClass, Properties prop, int source, int level, String msg, + Object params[], boolean multiline) { + mLogQueue.log(create(evtClass, prop, source, level, msg, params, multiline)); } - // ******************** end multiline log ************************* + //******************** end multiline log ************************* + /** - * Creates generic log event. If required, we can recycle events here. + * Creates generic log event. If required, we can recycle + * events here. */ - // XXXXXXXXXXX prop is out dated!!!! XXXXXXXXXXXXXXX - public ILogEvent create(int evtClass, Properties prop, int source, - int level, String msg, Object params[], boolean multiline) { - ILogEventFactory f = (ILogEventFactory) mFactories.get(Integer - .toString(evtClass)); + //XXXXXXXXXXX prop is out dated!!!! XXXXXXXXXXXXXXX + public ILogEvent create(int evtClass, Properties prop, int source, int level, + String msg, Object params[], boolean multiline) { + ILogEventFactory f = (ILogEventFactory) mFactories.get( + Integer.toString(evtClass)); if (f == null) return null; @@ -381,9 +365,8 @@ public class Logger implements ILogger { } /** - * Notifies logger to reuse the event. This framework opens up possibility - * to reuse event. - * + * Notifies logger to reuse the event. This framework + * opens up possibility to reuse event. * @param event a log event */ public void release(ILogEvent event) { diff --git a/pki/base/common/src/com/netscape/cmscore/logging/SignedAuditEventFactory.java b/pki/base/common/src/com/netscape/cmscore/logging/SignedAuditEventFactory.java index d66094cb..970516c1 100644 --- a/pki/base/common/src/com/netscape/cmscore/logging/SignedAuditEventFactory.java +++ b/pki/base/common/src/com/netscape/cmscore/logging/SignedAuditEventFactory.java @@ -17,6 +17,7 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cmscore.logging; + import java.util.Properties; import com.netscape.certsrv.logging.IBundleLogEvent; @@ -26,11 +27,12 @@ import com.netscape.certsrv.logging.ILogger; import com.netscape.certsrv.logging.SignedAuditEvent; import com.netscape.cmscore.util.Debug; + /** * A log event object for handling system messages * <P> - * - * @author mikep + * + * @author mikep * @author mzhao * @author cfu * @version $Revision$, $Date$ @@ -50,7 +52,7 @@ public class SignedAuditEventFactory implements ILogEventFactory { /** * Creates an log event. - * + * * @param evtClass the event type * @param prop the resource bundle * @param source the subsystem ID who creates the log event @@ -58,9 +60,10 @@ public class SignedAuditEventFactory implements ILogEventFactory { * @param multiline the log message has more than one line or not * @param msg the detail message of the log * @param params the parameters in the detail log message + */ public ILogEvent create(int evtClass, Properties prop, int source, - int level, boolean multiline, String msg, Object params[]) { + int level, boolean multiline, String msg, Object params[]) { if (evtClass != ILogger.EV_SIGNED_AUDIT) return null; @@ -76,8 +79,7 @@ public class SignedAuditEventFactory implements ILogEventFactory { eventType = typeMessage.substring(typeBegin + 6, colon); message = typeMessage.substring(colon + 2); - Debug.trace("SignedAuditEventFactory: create() message=" + message - + "\n"); + Debug.trace("SignedAuditEventFactory: create() message=" + message + "\n"); } else { // no type specified @@ -99,8 +101,8 @@ public class SignedAuditEventFactory implements ILogEventFactory { /** * Set the resource bundle of the log event. - * - * @param prop the properties + * + * @param prop the properties * @param event the log event */ protected void setProperties(Properties prop, IBundleLogEvent event) { @@ -117,7 +119,7 @@ public class SignedAuditEventFactory implements ILogEventFactory { /** * Releases an log event. - * + * * @param e the log event */ public void release(ILogEvent e) { diff --git a/pki/base/common/src/com/netscape/cmscore/logging/SignedAuditLogger.java b/pki/base/common/src/com/netscape/cmscore/logging/SignedAuditLogger.java index 34af748d..013447ce 100644 --- a/pki/base/common/src/com/netscape/cmscore/logging/SignedAuditLogger.java +++ b/pki/base/common/src/com/netscape/cmscore/logging/SignedAuditLogger.java @@ -17,19 +17,23 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cmscore.logging; + + + /** - * A class represents certificate server logger implementation. + * A class represents certificate server logger + * implementation. * <P> - * - * @author thomask + * + * @author thomask * @author mzhao * @version $Revision$, $Date$ */ public class SignedAuditLogger extends Logger { /** - * Constructs a generic logger, and registers a list of resident event - * factories. + * Constructs a generic logger, and registers a list + * of resident event factories. */ public SignedAuditLogger() { super(); diff --git a/pki/base/common/src/com/netscape/cmscore/logging/SystemEventFactory.java b/pki/base/common/src/com/netscape/cmscore/logging/SystemEventFactory.java index dfe25f03..7bef282b 100644 --- a/pki/base/common/src/com/netscape/cmscore/logging/SystemEventFactory.java +++ b/pki/base/common/src/com/netscape/cmscore/logging/SystemEventFactory.java @@ -17,6 +17,7 @@ // --- END COPYRIGHT BLOCK --- package com.netscape.cmscore.logging; + import java.util.Properties; import com.netscape.certsrv.logging.IBundleLogEvent; @@ -25,11 +26,12 @@ import com.netscape.certsrv.logging.ILogEventFactory; import com.netscape.certsrv.logging.ILogger; import com.netscape.certsrv.logging.SystemEvent; + /** * A log event object for handling system messages * <P> - * - * @author mikep + * + * @author mikep * @author mzhao * @version $Revision$, $Date$ */ @@ -48,7 +50,7 @@ public class SystemEventFactory implements ILogEventFactory { /** * Creates an log event. - * + * * @param evtClass the event type * @param prop the resource bundle * @param source the subsystem ID who creates the log event @@ -56,9 +58,10 @@ public class SystemEventFactory implements ILogEventFactory { * @param multiline the log message has more than one line or not * @param msg the detail message of the log * @param params the parameters in the detail log message + */ public ILogEvent create(int evtClass, Properties prop, int source, - int level, boolean multiline, String msg, Object params[]) { + int level, boolean multiline, String msg, Object params[]) { if (evtClass != ILogger.EV_SYSTEM) return null; SystemEvent event = new SystemEvent(msg, params); @@ -72,8 +75,8 @@ public class SystemEventFactory implements ILogEventFactory { /** * Set the resource bundle of the log event. - * - * @param prop the properties + * + * @param prop the properties * @param event the log event */ protected void setProperties(Properties prop, IBundleLogEvent event) { @@ -90,7 +93,7 @@ public class SystemEventFactory implements ILogEventFactory { /** * Releases an log event. - * + * * @param e the log event */ public void release(ILogEvent e) { |