Class/Object

org.apache.logging.log4j.scala

Logger

Related Docs: object Logger | package scala

Permalink

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.

Linear Supertypes
AnyVal, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Logger
  2. AnyVal
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  4. macro def apply(level: Level, message: AnyRef, cause: Throwable): Unit

    Permalink

    Logs an object at the given Level including the stack trace of the given Throwable.

    Logs an object at the given Level including the stack trace of the given Throwable.

    level

    the logging level

    message

    the message to be logged

    cause

    a Throwable

  5. macro def apply(level: Level, message: CharSequence, cause: Throwable): Unit

    Permalink

    Logs a string at the given Level including the stack trace of the given Throwable.

    Logs a string at the given Level including the stack trace of the given Throwable.

    level

    the logging level

    message

    the message to be logged

    cause

    a Throwable

  6. macro def apply(level: Level, message: Message, cause: Throwable): Unit

    Permalink

    Logs a Message at the given Level including the stack trace of the given Throwable.

    Logs a Message at the given Level including the stack trace of the given Throwable.

    level

    the logging level

    message

    the message to be logged

    cause

    a Throwable

  7. macro def apply(level: Level, message: AnyRef): Unit

    Permalink

    Logs an object at the given Level.

    Logs an object at the given Level.

    level

    the logging level

    message

    the message to be logged

  8. macro def apply(level: Level, message: CharSequence): Unit

    Permalink

    Logs a string at the given Level.

    Logs a string at the given Level.

    level

    the logging level

    message

    the message to be logged

  9. macro def apply(level: Level, message: Message): Unit

    Permalink

    Logs a Message at the given Level.

    Logs a Message at the given Level.

    level

    the logging level

    message

    the message to be logged

  10. macro def apply(level: Level, marker: Marker, message: AnyRef, cause: Throwable): Unit

    Permalink

    Logs an object with the specific Marker at the given Level including the stack trace of the given Throwable.

    Logs an object with the specific Marker at the given Level including the stack trace of the given Throwable.

    level

    the logging level

    marker

    the marker data specific to this log statement

    message

    the message to be logged

    cause

    the cause

  11. macro def apply(level: Level, marker: Marker, message: CharSequence, cause: Throwable): Unit

    Permalink

    Logs a string with the specific Marker at the given Level including the stack trace of the given Throwable.

    Logs a string with the specific Marker at the given Level including the stack trace of the given Throwable.

    level

    the logging level

    marker

    the marker data specific to this log statement

    message

    the message to be logged

    cause

    the cause

  12. macro def apply(level: Level, marker: Marker, message: Message, cause: Throwable): Unit

    Permalink

    Logs a Message with the specific Marker at the given Level including the stack trace of the given Throwable.

    Logs a Message with the specific Marker at the given Level including the stack trace of the given Throwable.

    level

    the logging level

    marker

    the marker data specific to this log statement

    message

    the message to be logged

    cause

    the cause

  13. macro def apply(level: Level, marker: Marker, message: AnyRef): Unit

    Permalink

    Logs an object with the specific Marker at the given Level.

    Logs an object with the specific Marker at the given Level.

    level

    the logging level

    marker

    the marker data specific to this log statement

    message

    the message to be logged

  14. macro def apply(level: Level, marker: Marker, message: CharSequence): Unit

    Permalink

    Logs a string with the specific Marker at the given Level.

    Logs a string with the specific Marker at the given Level.

    level

    the logging level

    marker

    the marker data specific to this log statement

    message

    the message to be logged

  15. macro def apply(level: Level, marker: Marker, message: Message): Unit

    Permalink

    Logs a Message with the specific Marker at the given Level.

    Logs a Message with the specific Marker at the given Level.

    level

    the logging level

    marker

    the marker data specific to this log statement

    message

    the message to be logged

  16. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  17. macro def catching(level: Level, t: Throwable): Unit

    Permalink

    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.

  18. macro def catching(t: Throwable): Unit

    Permalink

    Logs an exception or error that has been caught.

    Logs an exception or error that has been caught.

    t

    the Throwable.

  19. macro def debug(message: AnyRef, cause: Throwable): Unit

    Permalink
  20. macro def debug(message: CharSequence, cause: Throwable): Unit

    Permalink
  21. macro def debug(message: Message, cause: Throwable): Unit

    Permalink
  22. macro def debug(message: AnyRef): Unit

    Permalink
  23. macro def debug(message: CharSequence): Unit

    Permalink
  24. macro def debug(message: Message): Unit

    Permalink
  25. macro def debug(marker: Marker, message: AnyRef, cause: Throwable): Unit

    Permalink
  26. macro def debug(marker: Marker, message: CharSequence, cause: Throwable): Unit

    Permalink
  27. macro def debug(marker: Marker, message: Message, cause: Throwable): Unit

    Permalink
  28. macro def debug(marker: Marker, message: AnyRef): Unit

    Permalink
  29. macro def debug(marker: Marker, message: CharSequence): Unit

    Permalink
  30. macro def debug(marker: Marker, message: Message): Unit

    Permalink
  31. val delegate: ExtendedLogger

    Permalink
  32. macro def error(message: AnyRef, cause: Throwable): Unit

    Permalink
  33. macro def error(message: CharSequence, cause: Throwable): Unit

    Permalink
  34. macro def error(message: Message, cause: Throwable): Unit

    Permalink
  35. macro def error(message: AnyRef): Unit

    Permalink
  36. macro def error(message: CharSequence): Unit

    Permalink
  37. macro def error(message: Message): Unit

    Permalink
  38. macro def error(marker: Marker, message: AnyRef, cause: Throwable): Unit

    Permalink
  39. macro def error(marker: Marker, message: CharSequence, cause: Throwable): Unit

    Permalink
  40. macro def error(marker: Marker, message: Message, cause: Throwable): Unit

    Permalink
  41. macro def error(marker: Marker, message: AnyRef): Unit

    Permalink
  42. macro def error(marker: Marker, message: CharSequence): Unit

    Permalink
  43. macro def error(marker: Marker, message: Message): Unit

    Permalink
  44. macro def fatal(message: AnyRef, cause: Throwable): Unit

    Permalink
  45. macro def fatal(message: CharSequence, cause: Throwable): Unit

    Permalink
  46. macro def fatal(message: Message, cause: Throwable): Unit

    Permalink
  47. macro def fatal(message: AnyRef): Unit

    Permalink
  48. macro def fatal(message: CharSequence): Unit

    Permalink
  49. macro def fatal(message: Message): Unit

    Permalink
  50. macro def fatal(marker: Marker, message: AnyRef, cause: Throwable): Unit

    Permalink
  51. macro def fatal(marker: Marker, message: CharSequence, cause: Throwable): Unit

    Permalink
  52. macro def fatal(marker: Marker, message: Message, cause: Throwable): Unit

    Permalink
  53. macro def fatal(marker: Marker, message: AnyRef): Unit

    Permalink
  54. macro def fatal(marker: Marker, message: CharSequence): Unit

    Permalink
  55. macro def fatal(marker: Marker, message: Message): Unit

    Permalink
  56. def getClass(): Class[_ <: AnyVal]

    Permalink
    Definition Classes
    AnyVal → Any
  57. macro def info(message: AnyRef, cause: Throwable): Unit

    Permalink
  58. macro def info(message: CharSequence, cause: Throwable): Unit

    Permalink
  59. macro def info(message: Message, cause: Throwable): Unit

    Permalink
  60. macro def info(message: AnyRef): Unit

    Permalink
  61. macro def info(message: CharSequence): Unit

    Permalink
  62. macro def info(message: Message): Unit

    Permalink
  63. macro def info(marker: Marker, message: AnyRef, cause: Throwable): Unit

    Permalink
  64. macro def info(marker: Marker, message: CharSequence, cause: Throwable): Unit

    Permalink
  65. macro def info(marker: Marker, message: Message, cause: Throwable): Unit

    Permalink
  66. macro def info(marker: Marker, message: AnyRef): Unit

    Permalink
  67. macro def info(marker: Marker, message: CharSequence): Unit

    Permalink
  68. macro def info(marker: Marker, message: Message): Unit

    Permalink
  69. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  70. def logMessage(level: Level, marker: Marker, message: AnyRef, cause: Throwable): Unit

    Permalink

    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

  71. def logMessage(level: Level, marker: Marker, message: CharSequence, cause: Throwable): Unit

    Permalink

    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

  72. def logMessage(level: Level, marker: Marker, message: Message, cause: Throwable): Unit

    Permalink

    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

  73. macro def throwing[T <: Throwable](level: Level, t: T): T

    Permalink

    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

  74. macro def throwing[T <: Throwable](t: T): T

    Permalink

    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

  75. def toString(): String

    Permalink
    Definition Classes
    Any
  76. macro def trace(message: AnyRef, cause: Throwable): Unit

    Permalink
  77. macro def trace(message: CharSequence, cause: Throwable): Unit

    Permalink
  78. macro def trace(message: Message, cause: Throwable): Unit

    Permalink
  79. macro def trace(message: AnyRef): Unit

    Permalink
  80. macro def trace(message: CharSequence): Unit

    Permalink
  81. macro def trace(message: Message): Unit

    Permalink
  82. macro def trace(marker: Marker, message: AnyRef, cause: Throwable): Unit

    Permalink
  83. macro def trace(marker: Marker, message: CharSequence, cause: Throwable): Unit

    Permalink
  84. macro def trace(marker: Marker, message: Message, cause: Throwable): Unit

    Permalink
  85. macro def trace(marker: Marker, message: AnyRef): Unit

    Permalink
  86. macro def trace(marker: Marker, message: CharSequence): Unit

    Permalink
  87. macro def trace(marker: Marker, message: Message): Unit

    Permalink
  88. macro def traceEntry(message: Message): EntryMessage

    Permalink

    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

  89. macro def traceEntry(params: AnyRef*): EntryMessage

    Permalink

    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

  90. macro def traceEntry(): EntryMessage

    Permalink

    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

  91. macro def traceExit[R](message: Message, result: R): R

    Permalink

    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

  92. macro def traceExit[R](entryMessage: EntryMessage, result: R): R

    Permalink

    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 the traceEntry methods

    result

    The result being returned from the method call

    returns

    result

  93. macro def traceExit(entryMessage: EntryMessage): Unit

    Permalink

    Logs exiting from a method with no result.

    Logs exiting from a method with no result.

    entryMessage

    the EntryMessage returned from one of the traceEntry methods

  94. macro def traceExit[R](result: R): R

    Permalink

    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

  95. macro def traceExit(): Unit

    Permalink

    Logs exit from a method with no result.

  96. macro def warn(message: AnyRef, cause: Throwable): Unit

    Permalink
  97. macro def warn(message: CharSequence, cause: Throwable): Unit

    Permalink
  98. macro def warn(message: Message, cause: Throwable): Unit

    Permalink
  99. macro def warn(message: AnyRef): Unit

    Permalink
  100. macro def warn(message: CharSequence): Unit

    Permalink
  101. macro def warn(message: Message): Unit

    Permalink
  102. macro def warn(marker: Marker, message: AnyRef, cause: Throwable): Unit

    Permalink
  103. macro def warn(marker: Marker, message: CharSequence, cause: Throwable): Unit

    Permalink
  104. macro def warn(marker: Marker, message: Message, cause: Throwable): Unit

    Permalink
  105. macro def warn(marker: Marker, message: AnyRef): Unit

    Permalink
  106. macro def warn(marker: Marker, message: CharSequence): Unit

    Permalink
  107. macro def warn(marker: Marker, message: Message): Unit

    Permalink

Inherited from AnyVal

Inherited from Any

Ungrouped