org.apache.logging.log4j.simple
Class SimpleLogger

java.lang.Object
  extended by org.apache.logging.log4j.spi.AbstractLogger
      extended by org.apache.logging.log4j.simple.SimpleLogger
All Implemented Interfaces:
Serializable, Logger, ExtendedLogger

public class SimpleLogger
extends AbstractLogger

This is the default logger that is used when no suitable logging implementation is available.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.logging.log4j.spi.AbstractLogger
CATCHING_MARKER, DEFAULT_MESSAGE_FACTORY_CLASS, ENTRY_MARKER, EXCEPTION_MARKER, EXIT_MARKER, FLOW_MARKER, THROWING_MARKER
 
Constructor Summary
SimpleLogger(String name, Level defaultLevel, boolean showLogName, boolean showShortLogName, boolean showDateTime, boolean showContextMap, String dateTimeFormat, MessageFactory messageFactory, PropertiesUtil props, PrintStream stream)
           
 
Method Summary
 Level getLevel()
          Gets the Level associated with the Logger.
 boolean isEnabled(Level level, Marker marker, Message msg, Throwable t)
          Determines if logging is enabled.
 boolean isEnabled(Level level, Marker marker, Object msg, Throwable t)
          Determines if logging is enabled.
 boolean isEnabled(Level level, Marker marker, String msg)
          Determine if logging is enabled.
 boolean isEnabled(Level level, Marker marker, String msg, Object... p1)
          Determines if logging is enabled.
 boolean isEnabled(Level level, Marker marker, String msg, Throwable t)
          Determines if logging is enabled.
 void logMessage(String fqcn, Level level, Marker marker, Message msg, Throwable throwable)
          Always logs a message at the specified level.
 void setLevel(Level level)
           
 void setStream(PrintStream stream)
           
 
Methods inherited from class org.apache.logging.log4j.spi.AbstractLogger
catching, catching, catching, catchingMsg, checkMessageFactory, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, entry, entry, entry, entryMsg, error, error, error, error, error, error, error, error, error, error, error, error, error, error, exit, exit, exit, exitMsg, fatal, fatal, fatal, fatal, fatal, fatal, fatal, fatal, fatal, fatal, fatal, fatal, fatal, fatal, getMessageFactory, getName, info, info, info, info, info, info, info, info, info, info, info, info, info, info, isDebugEnabled, isDebugEnabled, isEnabled, isEnabled, isErrorEnabled, isErrorEnabled, isFatalEnabled, isFatalEnabled, isInfoEnabled, isInfoEnabled, isTraceEnabled, isTraceEnabled, isWarnEnabled, isWarnEnabled, log, log, log, log, log, log, log, log, log, log, log, log, log, log, logIfEnabled, logIfEnabled, logIfEnabled, logIfEnabled, logIfEnabled, logMessage, logMessage, logMessage, logMessage, printf, printf, throwing, throwing, throwing, throwingMsg, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, trace, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleLogger

public SimpleLogger(String name,
                    Level defaultLevel,
                    boolean showLogName,
                    boolean showShortLogName,
                    boolean showDateTime,
                    boolean showContextMap,
                    String dateTimeFormat,
                    MessageFactory messageFactory,
                    PropertiesUtil props,
                    PrintStream stream)
Method Detail

getLevel

public Level getLevel()
Description copied from interface: Logger
Gets the Level associated with the Logger.

Returns:
the Level associate with the Logger.

isEnabled

public boolean isEnabled(Level level,
                         Marker marker,
                         Message msg,
                         Throwable t)
Description copied from interface: ExtendedLogger
Determines if logging is enabled.

Parameters:
level - The logging Level to check.
marker - A Marker or null.
msg - The Message.
t - A Throwable.
Returns:
True if logging is enabled, false otherwise.

isEnabled

public boolean isEnabled(Level level,
                         Marker marker,
                         Object msg,
                         Throwable t)
Description copied from interface: ExtendedLogger
Determines if logging is enabled.

Parameters:
level - The logging Level to check.
marker - A Marker or null.
msg - The message.
t - A Throwable.
Returns:
True if logging is enabled, false otherwise.

isEnabled

public boolean isEnabled(Level level,
                         Marker marker,
                         String msg)
Description copied from interface: ExtendedLogger
Determine if logging is enabled.

Parameters:
level - The logging Level to check.
marker - A Marker or null.
msg - The message.
Returns:
True if logging is enabled, false otherwise.

isEnabled

public boolean isEnabled(Level level,
                         Marker marker,
                         String msg,
                         Object... p1)
Description copied from interface: ExtendedLogger
Determines if logging is enabled.

Parameters:
level - The logging Level to check.
marker - A Marker or null.
msg - The message.
p1 - The parameters.
Returns:
True if logging is enabled, false otherwise.

isEnabled

public boolean isEnabled(Level level,
                         Marker marker,
                         String msg,
                         Throwable t)
Description copied from interface: ExtendedLogger
Determines if logging is enabled.

Parameters:
level - The logging Level to check.
marker - A Marker or null.
msg - The message.
t - the exception to log, including its stack trace.
Returns:
True if logging is enabled, false otherwise.

logMessage

public void logMessage(String fqcn,
                       Level level,
                       Marker marker,
                       Message msg,
                       Throwable throwable)
Description copied from interface: ExtendedLogger
Always logs a message at the specified level. It is the responsibility of the caller to ensure the specified level is enabled.

Parameters:
fqcn - The fully qualified class name of the logger entry point, used to determine the caller class and method when location information needs to be logged.
level - The logging Level to check.
marker - A Marker or null.
msg - The Message.
throwable - the exception to log, including its stack trace.

setLevel

public void setLevel(Level level)

setStream

public void setStream(PrintStream stream)


Copyright © 1999-2015 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.