Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public final class Logger

  1. Object
  2. Logger

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.

Methods

public static Logger getLogger(Class<?> type)The logger named after type, its fully qualified class name.
public static Logger getLogger(String name)The logger with name.
public String getName()The name lines are written under.
public boolean isEnabled(Level level)Whether a line at level would be written.
public boolean isTraceEnabled()
public boolean isDebugEnabled()
public boolean isInfoEnabled()
public boolean isWarnEnabled()
public boolean isErrorEnabled()
public void trace(String message, Object... args)
public void debug(String message, Object... args)
public void info(String message, Object... args)
public void warn(String message, Object... args)
public void error(String message, Object... args)
public void log(Level level, String message, Object... args)Writes message at level, its {} placeholders filled from args.

Inherited methods

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.