edu.cmu.pslc.logging

## Class FileLogger

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

- All Implemented Interfaces:
    MessageLogger

      public class FileLogger
      extends AbstractMessageLogger

  This is a simple file logger, that will write to a file with the given name.

  It does not wrap the XML within the OLI XML.

  These files are readable by DataShop's FileLogger application.

  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
    `FileLogger(java.io.PrintWriter outputStream, java.lang.String encoding)` Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Closes the output stream; this is required.
    `static FileLogger` | `create(java.lang.String fileName)` Create the file logger given a file name.
    `static FileLogger` | `create(java.lang.String fileName, java.lang.String encoding)` Create the file logger given a file name.
    `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(Message message, java.lang.String timeString)` Logs a message with a new time stamp.
    `boolean` | `log(java.lang.String authToken, Message message)` Logs a message.
    `boolean` | `log(java.lang.String authToken, Message message, java.util.Date timeStamp)` Logs a message with a new time stamp.

    - ### 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

    - #### FileLogger

          public FileLogger(java.io.PrintWriter outputStream,
                    java.lang.String encoding)

      Constructor.
      Parameters:
        `outputStream` - the output stream
        `encoding` - the encoding to be indicated at the top of the XML

  - ### Method Detail

    - #### create

          public static FileLogger create(java.lang.String fileName)

      Create the file logger given a file name.
      Parameters:
        `fileName` - the file name
      Returns:
        the newly created file logger

    - #### create

          public static FileLogger create(java.lang.String fileName,
                          java.lang.String encoding)

      Create the file logger given a file name.
      Parameters:
        `fileName` - the file name
        `encoding` - the encoding to be indicated at the top of the XML
      Returns:
        the newly created file 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. This take an authentication token, but it is ignored.
      Parameters:
        `authToken` - the authentication token needed for authenticated logging (OLI servers)
        `message` - the message to log
      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. Converts the Date to a time string without a time zone.
      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. This take an authentication token, but it is ignored.
      Parameters:
        `authToken` - the authentication token needed for authenticated logging (OLI servers)
        `message` - the message to log
        `timeStamp` - the new time stamp to use
      Returns:
        true if log succeeded, false otherwise

    - #### log

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

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

    - #### close

          public void close()

      Closes the output stream; this is required.

Copyright (c) 2015 - Pittsburgh Science of Learning Center