Package helma.util

# Class Logger

java.lang.Object
helma.util.Logger

All Implemented Interfaces:
  `org.apache.commons.logging.Log`

Direct Known Subclasses:
  `FileLogger`

public class Logger extends Object implements org.apache.commons.logging.Log
A simple logger that writes to a PrintStream such as System.out.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`DEBUG`
`static final int`
`ERROR`
`static final int`
`FATAL`
`static final int`
`INFO`
`static final int`
`TRACE`
`static final int`
`WARN`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`Logger(PrintStream out)`
Create a logger for a PrintStream, such as System.out.

## Method Summary

Modifier and Type
Method
Description
`void`
`debug(Object parm1)`
`void`
`debug(Object parm1, Throwable parm2)`
`protected void`
`ensureOpen()`
This is called by the runner thread to to make sure we have an open writer.
`void`
`error(Object parm1)`
`void`
`error(Object parm1, Throwable parm2)`
`void`
`fatal(Object parm1)`
`void`
`fatal(Object parm1, Throwable parm2)`
`String`
`getCanonicalName()`
Return an object which identifies this logger.
`int`
`getLogLevel()`
Get the current log level.
`protected org.apache.commons.logging.Log`
`getSedatedLog()`
return a "quiet" version of this log that routes debug() output to trace()
`static String`
`getStackTrace(Throwable t)`
`void`
`info(Object parm1)`
`void`
`info(Object parm1, Throwable parm2)`
`boolean`
`isDebugEnabled()`
`boolean`
`isErrorEnabled()`
`boolean`
`isFatalEnabled()`
`boolean`
`isInfoEnabled()`
`boolean`
`isTraceEnabled()`
`boolean`
`isWarnEnabled()`
`protected void`
`log(String level, Object msg, Throwable exception)`
Append a message to the log.
`protected static void`
`renderDate()`
`void`
`setLogLevel(int logLevel)`
Set the log level for this logger.
`String`
`toString()`
Return a string representation of this Logger
`void`
`trace(Object parm1)`
`void`
`trace(Object parm1, Throwable parm2)`
`void`
`warn(Object parm1)`
`void`
`warn(Object parm1, Throwable parm2)`
`protected void`
`write()`
This is called by the runner thread to perform actual output.

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

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

## Field Details

### TRACE

public static final int TRACE

See Also:
  - Constant Field Values

### DEBUG

public static final int DEBUG

See Also:
  - Constant Field Values

### INFO

public static final int INFO

See Also:
  - Constant Field Values

### WARN

public static final int WARN

See Also:
  - Constant Field Values

### ERROR

public static final int ERROR

See Also:
  - Constant Field Values

### FATAL

public static final int FATAL

See Also:
  - Constant Field Values

## Constructor Details

### Logger

protected Logger(PrintStream out)
Create a logger for a PrintStream, such as System.out.

Parameters:
  `out` - the output stream

## Method Details

### getLogLevel

public int getLogLevel()
Get the current log level.

Returns:
  the current log level

### setLogLevel

public void setLogLevel(int logLevel)
Set the log level for this logger.

Parameters:
  `logLevel` - the new log level

### toString

public String toString()
Return a string representation of this Logger

Overrides:
  `toString` in class `Object`

### getCanonicalName

public String getCanonicalName()
Return an object which identifies this logger.

Returns:
  the canonical name of this logger

### log

protected void log(String level, Object msg, Throwable exception)
Append a message to the log.

Parameters:
  `level` - a string representing the log level
  `msg` - the log message
  `exception` - an exception, or null

### write

protected void write()
This is called by the runner thread to perform actual output.

### ensureOpen

protected void ensureOpen()
This is called by the runner thread to to make sure we have an open writer.

### renderDate

protected static void renderDate()

### isTraceEnabled

public boolean isTraceEnabled()

Specified by:
  `isTraceEnabled` in interface `org.apache.commons.logging.Log`

### isDebugEnabled

public boolean isDebugEnabled()

Specified by:
  `isDebugEnabled` in interface `org.apache.commons.logging.Log`

### isInfoEnabled

public boolean isInfoEnabled()

Specified by:
  `isInfoEnabled` in interface `org.apache.commons.logging.Log`

### isWarnEnabled

public boolean isWarnEnabled()

Specified by:
  `isWarnEnabled` in interface `org.apache.commons.logging.Log`

### isErrorEnabled

public boolean isErrorEnabled()

Specified by:
  `isErrorEnabled` in interface `org.apache.commons.logging.Log`

### isFatalEnabled

public boolean isFatalEnabled()

Specified by:
  `isFatalEnabled` in interface `org.apache.commons.logging.Log`

### trace

public void trace(Object parm1)

Specified by:
  `trace` in interface `org.apache.commons.logging.Log`

### trace

public void trace(Object parm1, Throwable parm2)

Specified by:
  `trace` in interface `org.apache.commons.logging.Log`

### debug

public void debug(Object parm1)

Specified by:
  `debug` in interface `org.apache.commons.logging.Log`

### debug

public void debug(Object parm1, Throwable parm2)

Specified by:
  `debug` in interface `org.apache.commons.logging.Log`

### info

public void info(Object parm1)

Specified by:
  `info` in interface `org.apache.commons.logging.Log`

### info

public void info(Object parm1, Throwable parm2)

Specified by:
  `info` in interface `org.apache.commons.logging.Log`

### warn

public void warn(Object parm1)

Specified by:
  `warn` in interface `org.apache.commons.logging.Log`

### warn

public void warn(Object parm1, Throwable parm2)

Specified by:
  `warn` in interface `org.apache.commons.logging.Log`

### error

public void error(Object parm1)

Specified by:
  `error` in interface `org.apache.commons.logging.Log`

### error

public void error(Object parm1, Throwable parm2)

Specified by:
  `error` in interface `org.apache.commons.logging.Log`

### fatal

public void fatal(Object parm1)

Specified by:
  `fatal` in interface `org.apache.commons.logging.Log`

### fatal

public void fatal(Object parm1, Throwable parm2)

Specified by:
  `fatal` in interface `org.apache.commons.logging.Log`

### getStackTrace

public static String getStackTrace(Throwable t)

### getSedatedLog

protected org.apache.commons.logging.Log getSedatedLog()
return a "quiet" version of this log that routes debug() output to trace()

Returns:
  a possibly less verbose version of this log.