Trait/Object

kadai.log.json

JsonLogging

Related Docs: object JsonLogging | package json

Permalink

trait JsonLogging extends Logging

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

Linear Supertypes
Logging, Logger, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. JsonLogging
  2. Logging
  3. Logger
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. def debug[A](msg: ⇒ A)(implicit arg0: LogWriter[A]): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging → Logger
  7. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  9. def error[A](msg: ⇒ A)(implicit arg0: LogWriter[A]): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging → Logger
  10. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  12. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  13. def info[A](msg: ⇒ A)(implicit arg0: LogWriter[A]): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging → Logger
  14. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  15. val log: org.apache.logging.log4j.Logger

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  16. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  20. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  21. def trace[A](msg: ⇒ A)(implicit arg0: LogWriter[A]): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging → Logger
  22. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. def warn[A](msg: ⇒ A)(implicit arg0: LogWriter[A]): Unit

    Permalink
    Attributes
    protected
    Definition Classes
    Logging → Logger
  26. def withContext[A, B](a: A)(f: ⇒ B)(implicit arg0: LogWriter[A]): B

    Permalink
    Definition Classes
    Logging
  27. def withDebug[A, B](msg: ⇒ A)(f: ⇒ B)(implicit arg0: LogWriter[A]): B

    Permalink
    Attributes
    protected
    Definition Classes
    Logging → Logger
  28. def withInfo[A, B](msg: ⇒ A)(f: ⇒ B)(implicit arg0: LogWriter[A]): B

    Permalink
    Attributes
    protected
    Definition Classes
    Logging → Logger
  29. def withTrace[A, B](msg: ⇒ A)(f: ⇒ B)(implicit arg0: LogWriter[A]): B

    Permalink
    Attributes
    protected
    Definition Classes
    Logging → Logger

Deprecated Value Members

  1. def withLog[A](s: String)(f: ⇒ A): A

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
    Annotations
    @deprecated
    Deprecated

    (Since version 1.6) use withInfo instead

  2. def withLogContext[A](s: String)(f: ⇒ A): A

    Permalink
    Definition Classes
    Logging
    Annotations
    @deprecated
    Deprecated

    (Since version 1.6) use withContext instead

Inherited from Logging

Inherited from Logger

Inherited from AnyRef

Inherited from Any

Ungrouped