final class Logger extends AnyVal
Scala wrapper for the Log4j Logger
interface.
Frequently the purpose of logging is to provide information about what is happening in the system, which requires including information about the objects being manipulated. In Scala, you can use string interpolation to achieve this:
logger.debug(s"Logging in user ${user.getName} with birthday ${user.calcBirthday}")
Since this wrapper is implemented with macros, the String construction and method invocations will only occur when debug logging is enabled.
- Alphabetic
- By Inheritance
- Logger
- AnyVal
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
##(): Int
- Definition Classes
- Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- Any
-
macro
def
apply(level: Level, message: AnyRef, cause: Throwable): Unit
Logs an object at the given
Level
including the stack trace of the givenThrowable
.Logs an object at the given
Level
including the stack trace of the givenThrowable
.- level
the logging level
- message
the message to be logged
- cause
a
Throwable
-
macro
def
apply(level: Level, message: CharSequence, cause: Throwable): Unit
Logs a string at the given
Level
including the stack trace of the givenThrowable
.Logs a string at the given
Level
including the stack trace of the givenThrowable
.- level
the logging level
- message
the message to be logged
- cause
a
Throwable
-
macro
def
apply(level: Level, message: Message, cause: Throwable): Unit
Logs a
Message
at the givenLevel
including the stack trace of the givenThrowable
.Logs a
Message
at the givenLevel
including the stack trace of the givenThrowable
.- level
the logging level
- message
the message to be logged
- cause
a
Throwable
-
macro
def
apply(level: Level, message: AnyRef): Unit
Logs an object at the given
Level
.Logs an object at the given
Level
.- level
the logging level
- message
the message to be logged
-
macro
def
apply(level: Level, message: CharSequence): Unit
Logs a string at the given
Level
.Logs a string at the given
Level
.- level
the logging level
- message
the message to be logged
-
macro
def
apply(level: Level, message: Message): Unit
Logs a
Message
at the givenLevel
.Logs a
Message
at the givenLevel
.- level
the logging level
- message
the message to be logged
-
macro
def
apply(level: Level, marker: Marker, message: AnyRef, cause: Throwable): Unit
Logs an object with the specific
Marker
at the givenLevel
including the stack trace of the givenThrowable
.Logs an object with the specific
Marker
at the givenLevel
including the stack trace of the givenThrowable
.- level
the logging level
- marker
the marker data specific to this log statement
- message
the message to be logged
- cause
the cause
-
macro
def
apply(level: Level, marker: Marker, message: CharSequence, cause: Throwable): Unit
Logs a string with the specific
Marker
at the givenLevel
including the stack trace of the givenThrowable
.Logs a string with the specific
Marker
at the givenLevel
including the stack trace of the givenThrowable
.- level
the logging level
- marker
the marker data specific to this log statement
- message
the message to be logged
- cause
the cause
-
macro
def
apply(level: Level, marker: Marker, message: Message, cause: Throwable): Unit
Logs a
Message
with the specificMarker
at the givenLevel
including the stack trace of the givenThrowable
.Logs a
Message
with the specificMarker
at the givenLevel
including the stack trace of the givenThrowable
.- level
the logging level
- marker
the marker data specific to this log statement
- message
the message to be logged
- cause
the cause
-
macro
def
apply(level: Level, marker: Marker, message: AnyRef): Unit
Logs an object with the specific
Marker
at the givenLevel
.Logs an object with the specific
Marker
at the givenLevel
.- level
the logging level
- marker
the marker data specific to this log statement
- message
the message to be logged
-
macro
def
apply(level: Level, marker: Marker, message: CharSequence): Unit
Logs a string with the specific
Marker
at the givenLevel
.Logs a string with the specific
Marker
at the givenLevel
.- level
the logging level
- marker
the marker data specific to this log statement
- message
the message to be logged
-
macro
def
apply(level: Level, marker: Marker, message: Message): Unit
Logs a
Message
with the specificMarker
at the givenLevel
.Logs a
Message
with the specificMarker
at the givenLevel
.- level
the logging level
- marker
the marker data specific to this log statement
- message
the message to be logged
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
macro
def
catching(level: Level, t: Throwable): Unit
Logs an exception or error that has been caught to a specific logging level.
Logs an exception or error that has been caught to a specific logging level.
- level
The logging Level.
- t
The Throwable.
-
macro
def
catching(t: Throwable): Unit
Logs an exception or error that has been caught.
Logs an exception or error that has been caught.
- t
the Throwable.
- macro def debug(message: AnyRef, cause: Throwable): Unit
- macro def debug(message: CharSequence, cause: Throwable): Unit
- macro def debug(message: Message, cause: Throwable): Unit
- macro def debug(message: AnyRef): Unit
- macro def debug(message: CharSequence): Unit
- macro def debug(message: Message): Unit
- macro def debug(marker: Marker, message: AnyRef, cause: Throwable): Unit
- macro def debug(marker: Marker, message: CharSequence, cause: Throwable): Unit
- macro def debug(marker: Marker, message: Message, cause: Throwable): Unit
- macro def debug(marker: Marker, message: AnyRef): Unit
- macro def debug(marker: Marker, message: CharSequence): Unit
- macro def debug(marker: Marker, message: Message): Unit
- val delegate: ExtendedLogger
- macro def error(message: AnyRef, cause: Throwable): Unit
- macro def error(message: CharSequence, cause: Throwable): Unit
- macro def error(message: Message, cause: Throwable): Unit
- macro def error(message: AnyRef): Unit
- macro def error(message: CharSequence): Unit
- macro def error(message: Message): Unit
- macro def error(marker: Marker, message: AnyRef, cause: Throwable): Unit
- macro def error(marker: Marker, message: CharSequence, cause: Throwable): Unit
- macro def error(marker: Marker, message: Message, cause: Throwable): Unit
- macro def error(marker: Marker, message: AnyRef): Unit
- macro def error(marker: Marker, message: CharSequence): Unit
- macro def error(marker: Marker, message: Message): Unit
- macro def fatal(message: AnyRef, cause: Throwable): Unit
- macro def fatal(message: CharSequence, cause: Throwable): Unit
- macro def fatal(message: Message, cause: Throwable): Unit
- macro def fatal(message: AnyRef): Unit
- macro def fatal(message: CharSequence): Unit
- macro def fatal(message: Message): Unit
- macro def fatal(marker: Marker, message: AnyRef, cause: Throwable): Unit
- macro def fatal(marker: Marker, message: CharSequence, cause: Throwable): Unit
- macro def fatal(marker: Marker, message: Message, cause: Throwable): Unit
- macro def fatal(marker: Marker, message: AnyRef): Unit
- macro def fatal(marker: Marker, message: CharSequence): Unit
- macro def fatal(marker: Marker, message: Message): Unit
-
def
getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
- macro def info(message: AnyRef, cause: Throwable): Unit
- macro def info(message: CharSequence, cause: Throwable): Unit
- macro def info(message: Message, cause: Throwable): Unit
- macro def info(message: AnyRef): Unit
- macro def info(message: CharSequence): Unit
- macro def info(message: Message): Unit
- macro def info(marker: Marker, message: AnyRef, cause: Throwable): Unit
- macro def info(marker: Marker, message: CharSequence, cause: Throwable): Unit
- macro def info(marker: Marker, message: Message, cause: Throwable): Unit
- macro def info(marker: Marker, message: AnyRef): Unit
- macro def info(marker: Marker, message: CharSequence): Unit
- macro def info(marker: Marker, message: Message): Unit
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
logMessage(level: Level, marker: Marker, message: AnyRef, cause: Throwable): Unit
Always logs a message at the specified level.
Always logs a message at the specified level. It is the responsibility of the caller to ensure the specified level is enabled.
Should normally not be used directly from application code, but needs to be public for access by macros.
- level
log level
- marker
marker or
null
- message
message
- cause
cause or
null
-
def
logMessage(level: Level, marker: Marker, message: CharSequence, cause: Throwable): Unit
Always logs a message at the specified level.
Always logs a message at the specified level. It is the responsibility of the caller to ensure the specified level is enabled.
Should normally not be used directly from application code, but needs to be public for access by macros.
- level
log level
- marker
marker or
null
- message
message
- cause
cause or
null
-
def
logMessage(level: Level, marker: Marker, message: Message, cause: Throwable): Unit
Always logs a message at the specified level.
Always logs a message at the specified level. It is the responsibility of the caller to ensure the specified level is enabled.
Should normally not be used directly from application code, but needs to be public for access by macros.
- level
log level
- marker
marker or
null
- message
message
- cause
cause or
null
-
macro
def
throwing[T <: Throwable](level: Level, t: T): T
Logs an exception or error to be thrown to a specific logging level.
Logs an exception or error to be thrown to a specific logging level.
throw logger.throwing(Level.DEBUG, myException)
- level
the logging Level.
- t
the Throwable
- returns
t
-
macro
def
throwing[T <: Throwable](t: T): T
Logs an exception or error to be thrown.
Logs an exception or error to be thrown.
throw logger.throwing(myException)
- t
the Throwable
- returns
t
-
def
toString(): String
- Definition Classes
- Any
- macro def trace(message: AnyRef, cause: Throwable): Unit
- macro def trace(message: CharSequence, cause: Throwable): Unit
- macro def trace(message: Message, cause: Throwable): Unit
- macro def trace(message: AnyRef): Unit
- macro def trace(message: CharSequence): Unit
- macro def trace(message: Message): Unit
- macro def trace(marker: Marker, message: AnyRef, cause: Throwable): Unit
- macro def trace(marker: Marker, message: CharSequence, cause: Throwable): Unit
- macro def trace(marker: Marker, message: Message, cause: Throwable): Unit
- macro def trace(marker: Marker, message: AnyRef): Unit
- macro def trace(marker: Marker, message: CharSequence): Unit
- macro def trace(marker: Marker, message: Message): Unit
-
macro
def
traceEntry(message: Message): EntryMessage
Logs entry to a method using a
Message
to describe the parameters.Logs entry to a method using a
Message
to describe the parameters.def doSomething(foo: Request): Unit = { logger.traceEntry(JsonMessage(foo)) // do something }
- message
the message
- returns
The built
EntryMessage
-
macro
def
traceEntry(params: AnyRef*): EntryMessage
Logs entry to a method along with its parameters.
Logs entry to a method along with its parameters.
def doSomething(foo: String, bar: Int): Unit = { logger.traceEntry(foo, bar) // do something }
- params
the parameters to the method.
- returns
The built
EntryMessage
-
macro
def
traceEntry(): EntryMessage
Logs entry to a method.
Logs entry to a method. Used when the method in question has no parameters or when the parameters should not be logged.
- returns
The built
EntryMessage
-
macro
def
traceExit[R](message: Message, result: R): R
Logs exiting from a method with result.
Logs exiting from a method with result. Allows custom formatting of the result.
- message
the Message containing the formatted result
- result
The result being returned from the method call.
- returns
result
-
macro
def
traceExit[R](entryMessage: EntryMessage, result: R): R
Logs exiting from a method with result.
Logs exiting from a method with result.
def doSomething(foo: String, bar: Int): Int = { val entryMessage = logger.traceEntry(foo, bar) // do something traceExit(entryMessage, value) }
- entryMessage
the
EntryMessage
returned from one of thetraceEntry
methods- result
The result being returned from the method call
- returns
result
-
macro
def
traceExit(entryMessage: EntryMessage): Unit
Logs exiting from a method with no result.
Logs exiting from a method with no result.
- entryMessage
the
EntryMessage
returned from one of thetraceEntry
methods
-
macro
def
traceExit[R](result: R): R
Logs exiting from a method with result.
Logs exiting from a method with result.
- result
The result being returned from the method call
- returns
result
-
macro
def
traceExit(): Unit
Logs exit from a method with no result.
- macro def warn(message: AnyRef, cause: Throwable): Unit
- macro def warn(message: CharSequence, cause: Throwable): Unit
- macro def warn(message: Message, cause: Throwable): Unit
- macro def warn(message: AnyRef): Unit
- macro def warn(message: CharSequence): Unit
- macro def warn(message: Message): Unit
- macro def warn(marker: Marker, message: AnyRef, cause: Throwable): Unit
- macro def warn(marker: Marker, message: CharSequence, cause: Throwable): Unit
- macro def warn(marker: Marker, message: Message, cause: Throwable): Unit
- macro def warn(marker: Marker, message: AnyRef): Unit
- macro def warn(marker: Marker, message: CharSequence): Unit
- macro def warn(marker: Marker, message: Message): Unit