Class Logger

java.lang.Object
com.codename1.backend.log.Logger

public final class Logger extends Object

An application logger in the shape slf4j's is, writing through Logging.

private static final Logger LOG = Logger.getLogger(PushService.class);

LOG.info("sent {} notifications to {}", count, appId);
LOG.warn("APNs rejected token", ex);
if (LOG.isDebugEnabled()) {
    LOG.debug("payload {}", render(payload));
}

Each {} in the message is replaced by the next argument; \{} is a literal {}. A throwable left over after the placeholders are filled -- the last argument, as slf4j takes it -- is written with its stack trace.

A line reads 2026-11-01T09:30:00.123Z INFO [thread] com.example.Push - message, followed by the thread's MDC context when it has one. The level of each logger comes from the logging.level.* settings; see Logging.

No reflection, no configuration file and no static binding: a logger is a name and a cached level.

  • Method Details

    • getLogger

      public static Logger getLogger(Class<?> type)
      The logger named after type, its fully qualified class name.
    • getLogger

      public static Logger getLogger(String name)
      The logger with name.
    • getName

      public String getName()
      The name lines are written under.
    • isEnabled

      public boolean isEnabled(Level level)
      Whether a line at level would be written.
    • isTraceEnabled

      public boolean isTraceEnabled()
    • isDebugEnabled

      public boolean isDebugEnabled()
    • isInfoEnabled

      public boolean isInfoEnabled()
    • isWarnEnabled

      public boolean isWarnEnabled()
    • isErrorEnabled

      public boolean isErrorEnabled()
    • trace

      public void trace(String message, Object... args)
    • debug

      public void debug(String message, Object... args)
    • info

      public void info(String message, Object... args)
    • warn

      public void warn(String message, Object... args)
    • error

      public void error(String message, Object... args)
    • log

      public void log(Level level, String message, Object... args)
      Writes message at level, its {} placeholders filled from args.