trait
JsonLogging extends Logging
Value Members
-
final
def
!=(arg0: AnyRef): Boolean
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: AnyRef): Boolean
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
def
debug[A](msg: ⇒ A)(implicit arg0: LogWriter[A]): Unit
-
final
def
eq(arg0: AnyRef): Boolean
-
def
equals(arg0: Any): Boolean
-
def
error[A](msg: ⇒ A)(implicit arg0: LogWriter[A]): Unit
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
def
info[A](msg: ⇒ A)(implicit arg0: LogWriter[A]): Unit
-
final
def
isInstanceOf[T0]: Boolean
-
val
log: org.apache.logging.log4j.Logger
-
final
def
ne(arg0: AnyRef): Boolean
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
def
trace[A](msg: ⇒ A)(implicit arg0: LogWriter[A]): Unit
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
-
def
warn[A](msg: ⇒ A)(implicit arg0: LogWriter[A]): Unit
-
def
withContext[A, B](a: A)(f: ⇒ B)(implicit arg0: LogWriter[A]): B
-
def
withDebug[A, B](msg: ⇒ A)(f: ⇒ B)(implicit arg0: LogWriter[A]): B
-
def
withInfo[A, B](msg: ⇒ A)(f: ⇒ B)(implicit arg0: LogWriter[A]): B
-
def
withTrace[A, B](msg: ⇒ A)(f: ⇒ B)(implicit arg0: LogWriter[A]): B
Deprecated Value Members
-
def
withLog[A](s: String)(f: ⇒ A): A
-
def
withLogContext[A](s: String)(f: ⇒ A): A
Inherited from Logging
Inherited from Logger
Inherited from AnyRef
Inherited from Any
Mixin if you want your class to be able to log structured objects in JSON format. You will need an argonaut.EncodeJson instance in implicit scope for the object you try and log.
To get the instances, you need to also "import JsonLogging._"
Note that you normally only need an implicit EncodeJson[A] for any type you want to log in order to encode the JSON representation that is logged. If you do not have an EncodeJson for the message object, then it will fall back to a String representation given by the Show[Foo] instance in scope.
If you want fine-grained control of the output, and in particular want to control the top level names that are produced, please create a custom implicit JsonMessgae.Qualified[Foo] that turns your Foo into a List[JsonAssoc]. Care is needed though about the names as any clashes can lead to bugs in some log processing systems, such as https://github.com/elastic/elasticsearch/issues/12366
See JsonLayout for details on how to configure log4j2 to support JSON output