how to add Log4J json template layout

https://logging.apache.org/log4j/2.x/manual/json-template-layout.html says:
Adding log4j-layout-template-json artifact to your list of dependencies is enough to enable access to JsonTemplateLayout in your Log4j configuration:
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-layout-template-json</artifactId>
<version>2.19.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-layout-template-json</artifactId>
<version>2.19.0</version>
</dependency>
Where should I be looking for my list of dependencies? Should it be my gradle file? Should I be looking at log4j.xml?
4 Replies
JavaBot
JavaBot3y ago
Hey, @Lil Villa! Please remember to /close this post once your question has been answered!
imp_o_rt
imp_o_rt3y ago
The article is explaining how to add the dependency to maven. You're using gradle for dependency management so you need to add a dependency in your gradle build file, see https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-layout-template-json/2.19.0
Lil Villa
Lil VillaOP3y ago
This is just what I needed! Thank you @imp_o_rt :prayge:
JavaBot
JavaBot3y ago
Post Closed
This post has been closed by <@249473164248219648>.

Did you find this page helpful?