Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Logback Config – Showing Debug Level

DZone's Guide to

Logback Config – Showing Debug Level

· Java Zone
Free Resource

Microservices! They are everywhere, or at least, the term is. When should you use a microservice architecture? What factors should be considered when making that decision? Do the benefits outweigh the costs? Why is everyone so excited about them, anyway?  Brought to you in partnership with IBM.

Showing Debug Logback Configuration

Logback provides the functionality to enable debug level output of its own status.

<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="true">

yields 

INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback-test.xml] at [file:/code/MyProject/target/test-classes/logback-test.xml]
INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [console]
INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.myco] to DEBUG
INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.springframework.test.web.servlet] to TRACE
INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.springframework.web.servlet] to TRACE
INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to WARN
INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [console] to Logger[ROOT]
INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
INFO in ch.qos.logback.classic.joran.JoranConfigurator@2c17306 - Registering current configuration as safe fallback point

However, I started using the logback.groovy configuration and I cannot seem to find a way to enable debug in the groovy config. We can turn on debug info via an environment variable logback.debug

  • Environment Variable: logback.debug=true
  • Java Define: -Dlogback.debug=true

Discover how the Watson team is further developing SDKs in Java, Node.js, Python, iOS, and Android to access these services and make programming easy. Brought to you in partnership with IBM.

Topics:

Published at DZone with permission of Gordon Dickens, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}