Index

A D G I M N T 
All Classes and Interfaces|All Packages

A

AppLog - Class in io.avaje.applog
Use of System.Logger for Application and Library logging.
AppLog.Provider - Interface in io.avaje.applog
Provide System.Logger implementations that would otherwise default to System.getLogger(String).

D

Default number format By default, numbers are formatted based on locale so 8080 can be formatted as 8,080. For this reason, we often prefer to format integers like {0,number,#} rather than {0}. // use {1,number,integer} to format the int port so we get 8080 rather than 8,080 logger.log(Level.INFO, "started with host {0} port {1,number,integer} ", host, port); Throwable and vararg parameters When logging a message with vararg parameters, slf4j will automatically try to detect if the last parameter is a Throwable and if so extract it and trim the parameters. System.Logger does not do this, instead we need to be explicit when logging Throwable and formatting the message if needed. System.Logger logger = AppLog.getLogger("org.foo"); // using varargs parameters all ok with no Throwable logger.log(Level.INFO, "My {0} Hello {1} message", "silly", "world"); try { someMethodThatThrows(); } catch (Throwable e) { // need to format message here and explicitly pass throwable logger.log(Level.ERROR, MessageFormat.format("Error using {0} and {1}", "MyParam0", "OtherParam1"), e); } No slf4j MDC or Markers System.Logger API has no equivalent to slf4j MDC or Markers. - Search tag in class io.avaje.applog.AppLog
Section

G

getLogger(Class<?>) - Static method in class io.avaje.applog.AppLog
Return the logger for the given class name.
getLogger(String) - Static method in class io.avaje.applog.AppLog
Return the logger for the given name.
getLogger(String) - Method in interface io.avaje.applog.AppLog.Provider
Return the logger implementation given the logger name.
getLogger(String, ResourceBundle) - Static method in class io.avaje.applog.AppLog
Return the logger for the given name and resource bundle.
getLogger(String, ResourceBundle) - Method in interface io.avaje.applog.AppLog.Provider
Return the logger implementation given the logger name and resource bundle.

I

io.avaje.applog - module io.avaje.applog
 
io.avaje.applog - package io.avaje.applog
Provides use of System.Logger for Application and Library logging API.

M

Main differences to slf4j-api - Search tag in class io.avaje.applog.AppLog
Section
MessageFormat placeholders System.Logger uses java.text.MessageFormat with placeholders like {0}, {1}, {2} ... rather than slf4j which uses {}. This means parameters can be referenced multiple times and the parameters can use formats like {0,number,#.##} {0,time} {0,date} etc. See java.text.MessageFormat for more details. Default number format By default, numbers are formatted based on locale so 8080 can be formatted as 8,080. For this reason, we often prefer to format integers like {0,number,#} rather than {0}. // use {1,number,integer} to format the int port so we get 8080 rather than 8,080 logger.log(Level.INFO, "started with host {0} port {1,number,integer} ", host, port); Throwable and vararg parameters When logging a message with vararg parameters, slf4j will automatically try to detect if the last parameter is a Throwable and if so extract it and trim the parameters. System.Logger does not do this, instead we need to be explicit when logging Throwable and formatting the message if needed. System.Logger logger = AppLog.getLogger("org.foo"); // using varargs parameters all ok with no Throwable logger.log(Level.INFO, "My {0} Hello {1} message", "silly", "world"); try { someMethodThatThrows(); } catch (Throwable e) { // need to format message here and explicitly pass throwable logger.log(Level.ERROR, MessageFormat.format("Error using {0} and {1}", "MyParam0", "OtherParam1"), e); } No slf4j MDC or Markers System.Logger API has no equivalent to slf4j MDC or Markers. - Search tag in class io.avaje.applog.AppLog
Section

N

No slf4j MDC or Markers System.Logger API has no equivalent to slf4j MDC or Markers. - Search tag in class io.avaje.applog.AppLog
Section

T

Throwable and vararg parameters When logging a message with vararg parameters, slf4j will automatically try to detect if the last parameter is a Throwable and if so extract it and trim the parameters. System.Logger does not do this, instead we need to be explicit when logging Throwable and formatting the message if needed. System.Logger logger = AppLog.getLogger("org.foo"); // using varargs parameters all ok with no Throwable logger.log(Level.INFO, "My {0} Hello {1} message", "silly", "world"); try { someMethodThatThrows(); } catch (Throwable e) { // need to format message here and explicitly pass throwable logger.log(Level.ERROR, MessageFormat.format("Error using {0} and {1}", "MyParam0", "OtherParam1"), e); } No slf4j MDC or Markers System.Logger API has no equivalent to slf4j MDC or Markers. - Search tag in class io.avaje.applog.AppLog
Section
A D G I M N T 
All Classes and Interfaces|All Packages