cz.cuni.jagrlib
Class LogFile

java.lang.Object
  extended by cz.cuni.jagrlib.LogFile

public class LogFile
extends java.lang.Object

Log-file for debuging messages, warning and errors dumps.

See Also:
LogFile.java

Field Summary
static boolean debugging
          Print verbose debug-logs.
static java.lang.String DEFAULT_PROBE
          Default probe file name (in Properties format).
protected static boolean empty
          Is log-file still empty?
protected static boolean first
          Log-file stream was not opened before?
protected static IntMap<cz.cuni.jagrlib.LogImage> images
          Collection of log-images.
protected static long lastCollectionCount
           
protected static long lastCollectionTime
           
protected static java.io.PrintStream logFile
          Log-file object.
static java.lang.String logFileName
          Log-file name.
protected static int nextId
          Image id that will be used next time.
protected static java.util.Properties probe
          Property set for "run-time probe".
static java.lang.String SEPARATOR1
           
static java.lang.String SEPARATOR2
           
static java.lang.String SEPARATOR3
           
static java.util.Date startDate
          Time of program startup.
static boolean tracing
          Trace mode (used externally).
 
Constructor Summary
LogFile()
           
 
Method Summary
static boolean booleanProperty(java.lang.String key, boolean def)
          Gets value of the given boolean property.
static void close()
          Close underlying log-file stream.
static void closeImage(int id)
          Closes the log-image (invalidates its id).
static int createImage(int width, int height, int mode, java.lang.String fileName)
          Create a new log-image.
static void debug(java.lang.String s)
           
static double doubleProperty(java.lang.String key, double def)
          Gets value of the given floating-point property.
static void error(java.lang.String s)
           
static void exception(java.lang.String s, java.lang.Throwable ex)
          Writes exception dump (with stack trace).
static void exception(java.lang.Throwable ex)
          Writes exception dump (with stack trace).
static RasterGraphics getImage(int id)
          Retrieves RasterGraphics object from log-image is.
protected static boolean checkProlog()
          Checks if the log-file was already initialized.
static int intProperty(java.lang.String key, int def)
          Gets value of the given integer property.
static void log(java.lang.String s)
           
static void memoryStatistics()
          Prints memory statistics: heap statistics & garbage-collection statistics.
protected static void printTime()
          Prints time relative to program startup (in millisecond-resolution).
static boolean readProbe(java.lang.String fileName)
          Reads the given "probe" into property set, returns true if succeeded.
static void resetMemoryStatistics()
          Reset cummulative memory statistics (garbage collector statistics).
static void saveImage(int id)
          Save the given log-image.
static java.lang.Object setProperty(java.lang.String key, java.lang.String value)
          Sets new value of the general (String) property.
static void stackTrace(java.lang.String s)
           
static java.lang.String stringProperty(java.lang.String key)
          Gets value of the general (String) property.
static void warning(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debugging

public static boolean debugging
Print verbose debug-logs.


tracing

public static boolean tracing
Trace mode (used externally).


logFile

protected static java.io.PrintStream logFile
Log-file object.


empty

protected static boolean empty
Is log-file still empty?


first

protected static boolean first
Log-file stream was not opened before?


logFileName

public static java.lang.String logFileName
Log-file name.


startDate

public static java.util.Date startDate
Time of program startup.


probe

protected static java.util.Properties probe
Property set for "run-time probe". Is reloaded before each composition run.


DEFAULT_PROBE

public static final java.lang.String DEFAULT_PROBE
Default probe file name (in Properties format).

See Also:
Constant Field Values

SEPARATOR1

public static final java.lang.String SEPARATOR1
See Also:
Constant Field Values

SEPARATOR2

public static final java.lang.String SEPARATOR2
See Also:
Constant Field Values

SEPARATOR3

public static final java.lang.String SEPARATOR3
See Also:
Constant Field Values

lastCollectionCount

protected static long lastCollectionCount

lastCollectionTime

protected static long lastCollectionTime

nextId

protected static int nextId
Image id that will be used next time.


images

protected static IntMap<cz.cuni.jagrlib.LogImage> images
Collection of log-images.

Constructor Detail

LogFile

public LogFile()
Method Detail

checkProlog

protected static boolean checkProlog()
Checks if the log-file was already initialized. If not, writes the log-file prolog.

Returns:
True if log-file is ready to use.

close

public static void close()
Close underlying log-file stream.


exception

public static void exception(java.lang.Throwable ex)
Writes exception dump (with stack trace).

Parameters:
ex - Throwable holding stack-trace.

exception

public static void exception(java.lang.String s,
                             java.lang.Throwable ex)
Writes exception dump (with stack trace).

Parameters:
s - Additional message.
ex - Throwable holding stack-trace.

log

public static void log(java.lang.String s)

warning

public static void warning(java.lang.String s)

error

public static void error(java.lang.String s)

debug

public static void debug(java.lang.String s)

stackTrace

public static void stackTrace(java.lang.String s)

printTime

protected static void printTime()
Prints time relative to program startup (in millisecond-resolution).


resetMemoryStatistics

public static void resetMemoryStatistics()
Reset cummulative memory statistics (garbage collector statistics).


memoryStatistics

public static void memoryStatistics()
Prints memory statistics: heap statistics & garbage-collection statistics.


readProbe

public static boolean readProbe(java.lang.String fileName)
Reads the given "probe" into property set, returns true if succeeded.


setProperty

public static java.lang.Object setProperty(java.lang.String key,
                                           java.lang.String value)
Sets new value of the general (String) property.


stringProperty

public static java.lang.String stringProperty(java.lang.String key)
Gets value of the general (String) property. Returns null if not found.


intProperty

public static int intProperty(java.lang.String key,
                              int def)
Gets value of the given integer property. Returns def if not found.


doubleProperty

public static double doubleProperty(java.lang.String key,
                                    double def)
Gets value of the given floating-point property. Returns def if not found.


booleanProperty

public static boolean booleanProperty(java.lang.String key,
                                      boolean def)
Gets value of the given boolean property. Returns def if not found.


createImage

public static int createImage(int width,
                              int height,
                              int mode,
                              java.lang.String fileName)
Create a new log-image. Returns its id.


getImage

public static RasterGraphics getImage(int id)
Retrieves RasterGraphics object from log-image is.


saveImage

public static void saveImage(int id)
Save the given log-image.


closeImage

public static void closeImage(int id)
Closes the log-image (invalidates its id).