Skip to content

Instantly share code, notes, and snippets.

@mikeananev
Created January 5, 2020 12:37
Show Gist options
  • Save mikeananev/5aeb6cb0879b75f84c60727f0e3395c2 to your computer and use it in GitHub Desktop.
Save mikeananev/5aeb6cb0879b75f84c60727f0e3395c2 to your computer and use it in GitHub Desktop.
Programmatic configuration of log4j2
(ns user
(:import (org.apache.logging.log4j.core.config.builder.api ConfigurationBuilderFactory)
(org.apache.logging.log4j.core.config Configurator)
(org.apache.logging.log4j Level)))
(def builder (ConfigurationBuilderFactory/newConfigurationBuilder))
(def console (.newAppender builder "stdout" "console"))
(.add builder console)
(Configurator/setRootLevel Level/DEBUG)
(println "log4j2 is configured.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment