Holger's Java API

## com.antelmann.util.logging
Class LogEntry

    java.lang.Object
      com.antelmann.util.logging.LogEntry

All Implemented Interfaces:
  Timed, Serializable

    public class LogEntry

extends Object
implements Serializable, Timed

LogEntry represents a single record of a log logged by a Logger object and handled by a LogWriter object. As opposed to java.util.logging.LogRecord, this class also maintains a stack trace. Note on serialization: as this class contains an array of Object, the serialization of an instance may throw an IOException if one of the contained objects is not serializable. A workaround may be to use the `Object.toString()` function to serialize the object; this could either be done through subclassing or through the LogWriter object that handles the serialization.

Author:
  Holger Antelmann
See Also:
  `Logger`, `LogWriter`, Serialized Form

Field Summary

Fields inherited from interface com.antelmann.calendar.Timed
`COMPARATOR, DATE_EXTRACTOR`

Constructor Summary
`LogEntry()`
`LogEntry(Level level, String message, long time, String sourceClassName, String sourceString, Throwable thrown, String threadName, StackTraceElement[] stack, Object... parameters)`

Method Summary
`Date` `getDate()` convenience method returning the time as a Date object
`Level` `getLevel()`
`String` `getMessage()`
`Object[]` `getParameters()`
`long` `getSequenceNumber()` only unique within the VM that constructed this instance
`String` `getSimpleSourceClassName()`
`Class<?>` `getSourceClass()` uses the context class loader of the current thread; may return null if no source class was given
`Class<?>` `getSourceClass(ClassLoader classLoader)`
`String` `getSourceClassName()`
`String` `getSourceString()`
`StackTraceElement[]` `getStackTrace()`
`String` `getStackTraceAsString(boolean reversed)`
`String` `getThreadName()`
`Throwable` `getThrown()`
`long` `getTime()`
`void` `setLevel(Level level)`
`void` `setMessage(String message)`
`void` `setParameters(Object[] parameters)`
`void` `setSourceClassName(String sourceClassName)`
`void` `setSourceString(String sourceString)`
`void` `setStackTrace(StackTraceElement[] stack)`
`void` `setThreadName(String threadName)`
`void` `setThrown(Throwable thrown)`
`void` `setTime(long time)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LogEntry

    public LogEntry()

### LogEntry

    public LogEntry(Level level,
                    String message,
                    long time,
                    String sourceClassName,
                    String sourceString,
                    Throwable thrown,
                    String threadName,
                    StackTraceElement[] stack,
                    Object... parameters)

Method Detail

### getLevel

    public Level getLevel()

### setLevel

    public void setLevel(Level level)

### getSequenceNumber

    public long getSequenceNumber()

  only unique within the VM that constructed this instance

### getMessage

    public String getMessage()

### setMessage

    public void setMessage(String message)

### getDate

    public Date getDate()

  convenience method returning the time as a Date object

### getTime

    public long getTime()

  Specified by:
    `getTime` in interface `Timed`

### setTime

    public void setTime(long time)

### getSourceString

    public String getSourceString()

### setSourceString

    public void setSourceString(String sourceString)

### getSourceClassName

    public String getSourceClassName()

### getSimpleSourceClassName

    public String getSimpleSourceClassName()

### getSourceClass

    public Class<?> getSourceClass()
                            throws ClassNotFoundException

  uses the context class loader of the current thread; may return null if no source class was given

  Throws:
    `ClassNotFoundException`

### getSourceClass

    public Class<?> getSourceClass(ClassLoader classLoader)
                            throws ClassNotFoundException

  Throws:
    `ClassNotFoundException`

### setSourceClassName

    public void setSourceClassName(String sourceClassName)

### getThrown

    public Throwable getThrown()

### setThrown

    public void setThrown(Throwable thrown)

### getThreadName

    public String getThreadName()

### setThreadName

    public void setThreadName(String threadName)

### getStackTraceAsString

    public String getStackTraceAsString(boolean reversed)

### getStackTrace

    public StackTraceElement[] getStackTrace()

### setStackTrace

    public void setStackTrace(StackTraceElement[] stack)

### getParameters

    public Object[] getParameters()

### setParameters

    public void setParameters(Object[] parameters)

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads