Skip to content

Repository files navigation

Chapter 5: Capturing Application State with Logging Frameworks

This repository contains the code from the book for Chapter 5, Capturing Application State with Logging Frameworks. See the main book page for the list of all chapter specific repositories.

How this repository is organized

In this repository, all code is in the main branch. There are seven folders:

Folder Name Contents
println Logging without a framework
java-util-logging Java Util Logging examples
log4J Log4j examples
logback Logback examples
slf4j-no-library-connfigured SLF4J example without a library.
slf4j-with-simple SLF4J example with slf4j-simple configured
slf4j-conversion SLF4J example with log4j configured

Note that many configuration files are supplied. If you want to run with the defaults, please delete these files from src/main/resources of that example.

How to run the examples in this chapter

If you want to use an IDE, import the directory you want as a Maven project so you have the proper logging dependencies.

If you want to use the command line, cd to the directory for that example and run

mvn verify

Java Util Logging

To run using the system property from the command line example, run the following from the Ch05-Logging/java-util-logging directory:

java -Djava.util.logging.config.file=src/main/resources/logging-warning.properties src/main/java/com/wiley/realworldjava/logging/jul/BasicConfigCommandLine.java

The other examples include the System property in Java code to make it easier to run the examples

If IntelliJ complains about a target/production directory

Open your .idea/*.iml file and change the inherit-compiler-output value to false

Clickable Links from the Further References Section

Java Util Logging

Log4j

SLF4J

Logback

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages