Class LogEvent

java.lang.Object
com.netscape.certsrv.logging.LogEvent
All Implemented Interfaces:
ILogEvent, Serializable
Direct Known Subclasses:
AuditEvent, SignedAuditEvent

public class LogEvent extends Object implements ILogEvent
See Also:
  • Constructor Details

    • LogEvent

      public LogEvent()
    • LogEvent

      public LogEvent(String msgFormat)
      Constructs a message event

      Parameters:
      msgFormat - the message string
    • LogEvent

      public LogEvent(String msgFormat, String param)
      Constructs a message with a parameter. For example,
       new AuditEvent("failed to load {0}", fileName);
       

      Parameters:
      msgFormat - details in message string format
      param - message string parameter
    • LogEvent

      public LogEvent(String msgFormat, Exception exception)
      Constructs a message from an exception. It can be used to carry a system exception that may contain information about the context. For example,
               try {
                ...
               } catch (IOExeption e) {
                    logHandler.log(new AuditEvent("Encountered System Error {0}", e);
            }
       

      Parameters:
      msgFormat - exception details in message string format
      exception - system exception
    • LogEvent

      public LogEvent(Exception e)
      Constructs a message from a base exception. This will use the msgFormat from the exception itself.
               try {
                ...
               } catch (Exception e) {
                    logHandler.log(new AuditEvent(e));
            }
       

      Parameters:
      e - CMS exception
    • LogEvent

      public LogEvent(String msgFormat, Object[] params)
      Constructs a message event with a list of parameters that will be substituted into the message format.

      Parameters:
      msgFormat - message string format
      params - list of message format parameters
  • Method Details

    • getMessage

      public String getMessage()
      Returns the current message format string.

      Returns:
      details message
    • setMessage

      public void setMessage(String message)
    • getParameters

      public Object[] getParameters()
      Returns a list of parameters.

      Returns:
      list of message format parameters
    • setParameters

      public void setParameters(Object[] params)
      Sets audit event's parameters.
    • getSource

      public LogSource getSource()
      Retrieves log source.
      Specified by:
      getSource in interface ILogEvent
      Returns:
      the component source where this message event was triggered
    • setSource

      public void setSource(LogSource source)
      Sets log source.
      Parameters:
      source - the component source where this message event was triggered
    • getLevel

      public int getLevel()
      Retrieves log level. The log level of an event represents its relative importance or severity within CMS.
      Specified by:
      getLevel in interface ILogEvent
      Returns:
      Integer log level value.
    • getNTEventType

      public int getNTEventType()
      Retrieves NT specific log event type.
      Specified by:
      getNTEventType in interface ILogEvent
      Returns:
      Integer NTEventType value.
    • setLevel

      public void setLevel(int level)
      Sets log level, NT log event type. For certain log levels the NT log event type gets set as well.
      Parameters:
      level - Integer log level value.
    • getMultiline

      public boolean getMultiline()
      Retrieves log multiline attribute.
      Specified by:
      getMultiline in interface ILogEvent
      Returns:
      Boolean whether or not this event is multiline. A multiline message simply consists of more than one line.
    • setMultiline

      public void setMultiline(boolean multiline)
      Sets log multiline attribute. A multiline message consists of more than one line.
      Parameters:
      multiline - Boolean multiline value.
    • getTimeStamp

      public long getTimeStamp()
      Retrieves event time stamp.
      Specified by:
      getTimeStamp in interface ILogEvent
      Returns:
      Long integer of the time the event was created.
    • getEventType

      public String getEventType()
      Retrieves log event type. Each type of event has an associated String type value.
      Specified by:
      getEventType in interface ILogEvent
      Returns:
      String containing the type of event.
    • setEventType

      public void setEventType(String eventType)
      Sets log event type. Each type of event has an associated String type value.
      Specified by:
      setEventType in interface ILogEvent
      Parameters:
      eventType - String containing the type of event.
    • toString

      public String toString()
      Return string representation of log message.
      Overrides:
      toString in class Object
      Returns:
      String containing log message.