PageBoxLib
Class Log

java.lang.Object
  extended byPageBoxLib.Log

public class Log
extends java.lang.Object

Logging class.

Changes:

alexis.grandemange@pagebox.net

Copyright (c) 2002-2004 Alexis Grandemange

This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public License
 as published by the Free Software Foundation; version 2.1 of the
 License.
 This library 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 Lesser General Public License for more details.
 A copy of the GNU Lesser General Public License lesser.txt should be
 included in the distribution.

Version:
0, 1, 0
Author:
Alexis Grandemange

Field Summary
private  java.io.PrintWriter log
          Log file
private  java.lang.String logFile
          Path of the log file
private static java.util.HashMap logs
          Log map Key: path of the log file Value: Log object
(package private)  boolean mode
          True if information messages
private  java.text.SimpleDateFormat sdf
          SimpleDateFormat used to build log entries
private  java.lang.SecurityManager sm
          Handle to the Security Manager.
 
Constructor Summary
private Log(java.lang.String logFile, boolean mode)
          Constructor.
 
Method Summary
(package private)  void end()
          Close the log file.
 void erase()
          Clear the trace.
 void error(java.lang.String src, java.lang.String msg)
          Log an error message.
 java.lang.String getAudit(java.lang.String arch)
          Returns the audit entries specific to an archive on a PageBox.
static Log getLog(java.lang.String logFile, boolean mode)
          Return a Log object from logs.
 boolean getMode()
          Get the tracing mode.
 java.io.BufferedReader getReader()
          Get a Reader on the log file.
 void info(java.lang.String src, java.lang.String msg)
          Log an information message.
 void setMode(boolean mode)
          Set the tracing mode.
 void warn(java.lang.String src, java.lang.String msg)
          Log a warning message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sdf

private final java.text.SimpleDateFormat sdf
SimpleDateFormat used to build log entries


mode

boolean mode
True if information messages


logFile

private java.lang.String logFile
Path of the log file


logs

private static java.util.HashMap logs
Log map


sm

private java.lang.SecurityManager sm
Handle to the Security Manager. Tested for null.


log

private java.io.PrintWriter log
Log file

Constructor Detail

Log

private Log(java.lang.String logFile,
            boolean mode)
Constructor. Open the log file. Starting with version 0.0.4 the constructor writes a mode.txt file. InstallAPI reads this file. The mode stored in mode.txt is ignored when the archive is hosted by the same Application server instance as the controlling PageBox and if the archive doesn't include the InstallAPI class. Otherwise the mode stored in mode is used.

Parameters:
logFile - path of the log file
mode - true if information messages
Method Detail

getLog

public static Log getLog(java.lang.String logFile,
                         boolean mode)
Return a Log object from logs. Public because used in PageBox.Audit.

Parameters:
logFile - path of the log file
mode - true if information messages

getReader

public java.io.BufferedReader getReader()
Get a Reader on the log file. Public because used in PageBox.Audit.

Returns:
reader on the log file

setMode

public final void setMode(boolean mode)
Set the tracing mode. Public because used in PageBox.Audit.

Parameters:
mode - true if information messages

getMode

public final boolean getMode()
Get the tracing mode. Public because used in PageBox.Audit.

Returns:
true if information messages

erase

public final void erase()
Clear the trace. Public because used in PageBox.Audit.


info

public void info(java.lang.String src,
                 java.lang.String msg)
Log an information message. Public because used in PageBox.Audit.

Parameters:
src - archive / PageBox
msg - message

warn

public void warn(java.lang.String src,
                 java.lang.String msg)
Log a warning message. Public because used in PageBox.Audit.

Parameters:
src - archive / PageBox
msg - message

error

public void error(java.lang.String src,
                  java.lang.String msg)
Log an error message. Public because used in PageBox.Audit.

Parameters:
src - archive / PageBox
msg - message

getAudit

public java.lang.String getAudit(java.lang.String arch)
Returns the audit entries specific to an archive on a PageBox. Called by DeployImpl.

Parameters:
arch - archive name
Returns:
audit entries

end

void end()
Close the log file. Called by DynDns.