edu.cmu.pslc.logging

## Class OliDatabaseLogger

- java.lang.Object
- - edu.cmu.pslc.logging.AbstractMessageLogger
  - - edu.cmu.pslc.logging.OliDatabaseLogger

- All Implemented Interfaces:
    MessageLogger

      public class OliDatabaseLogger
      extends AbstractMessageLogger

  This logger will log to a OLI-style log database directly. It will log to either the PSLC production server or the PSLC QA server based on the parameter passed into the create method. It can log to any available OLI-style log database given the correct URL as well.

  This does not create a file, see OliDiskLogger or FileLogger to create a file.

  Version:
    $Revision: 6000 $
    Last modified by: $Author: alida $
    Last modified on: $Date: 2010-02-26 15:18:28 -0500 (Fri, 26 Feb 2010) $
  Author:
    Alida Skogsholm

- - ### Field Summary

    - ### Fields inherited from class edu.cmu.pslc.logging.AbstractMessageLogger

      `CLOSE_ROOT_NODE, ENCODING_ISO_8859_1, ENCODING_UTF8, INFO_TYPE, PROD_URL, QA_URL`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OliDatabaseLogger(edu.cmu.oli.log.client.StreamLogger streamLogger, java.lang.String encoding)` Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Does nothing.
    `static OliDatabaseLogger` | `create(boolean prodFlag)` Create the message logger.
    `static OliDatabaseLogger` | `create(boolean prodFlag, java.lang.String encoding)` Create the message logger.
    `static OliDatabaseLogger` | `create(java.lang.String url, java.lang.String encoding)` Create the message logger and log to the given URL.
    `boolean` | `log(Message message)` Logs a message to the previously given file.
    `boolean` | `log(Message message, java.util.Date timeStamp)` Logs a message with a new time stamp.
    `boolean` | `log(java.lang.String authToken, Message message)` Logs a message with an authentication token.
    `boolean` | `log(java.lang.String authToken, Message message, java.util.Date timeStamp)` Logs a message with a new time stamp, and an authentication token.
    `void` | `logSession(java.lang.String userName, java.lang.String sessionId)` Log a SessionLog record.

    - ### Methods inherited from class edu.cmu.pslc.logging.AbstractMessageLogger

      `getCloseXml, getOpenXml, getOpenXmlSchemaType`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### OliDatabaseLogger

          public OliDatabaseLogger(edu.cmu.oli.log.client.StreamLogger streamLogger,
                           java.lang.String encoding)

      Constructor.
      Parameters:
        `streamLogger` - the OLI stream logger
        `encoding` - the encoding to be indicated at the top of the XML

  - ### Method Detail

    - #### create

          public static OliDatabaseLogger create(boolean prodFlag)

      Create the message logger. Need to indicate whether to log to the PSLC Production logging server or not. Pass in true for production, false for QA (testing).
      Parameters:
        `prodFlag` - indicates whether to log to the production server
      Returns:
        the newly created OLI database logger

    - #### create

          public static OliDatabaseLogger create(boolean prodFlag,
                                 java.lang.String encoding)

      Create the message logger. Need to indicate whether to log to the PSLC Production logging server or not. Pass in true for production, false for QA (testing).
      Parameters:
        `prodFlag` - indicates whether to log to the production server
        `encoding` - the encoding to be indicated at the top of the XML
      Returns:
        the newly created OLI database logger

    - #### create

          public static OliDatabaseLogger create(java.lang.String url,
                                 java.lang.String encoding)

      Create the message logger and log to the given URL.
      Parameters:
        `url` - indicates the URL for the logging server
        `encoding` - the encoding to be indicated at the top of the XML
      Returns:
        the newly created OLI database logger

    - #### log

          public boolean log(Message message)

      Logs a message to the previously given file.
      Parameters:
        `message` - the message to log to the file
      Returns:
        true if log succeeded, false otherwise

    - #### log

          public boolean log(java.lang.String authToken,
                    Message message)

      Logs a message with an authentication token.
      Parameters:
        `message` - the message to log
        `authToken` - the authentication token needed for authenticated logging (OLI servers)
      Returns:
        true if log succeeded, false otherwise

    - #### log

          public boolean log(Message message,
                    java.util.Date timeStamp)

      Logs a message with a new time stamp.
      Parameters:
        `message` - the message to log
        `timeStamp` - the new time stamp to use
      Returns:
        true if log succeeded, false otherwise

    - #### log

          public boolean log(java.lang.String authToken,
                    Message message,
                    java.util.Date timeStamp)

      Logs a message with a new time stamp, and an authentication token.
      Parameters:
        `message` - the message to log
        `timeStamp` - the new time stamp to use
        `authToken` - the authentication token needed for authenticated logging (OLI servers)
      Returns:
        true if log succeeded, false otherwise

    - #### logSession

          public void logSession(java.lang.String userName,
                        java.lang.String sessionId)

      Log a SessionLog record.
      Parameters:
        `userName` - the user name
        `sessionId` - the session id
      See Also:
        `SessionLog`

    - #### close

          public void close()

      Does nothing.

Copyright (c) 2015 - Pittsburgh Science of Learning Center