The document discusses garbage collection and object graphs. It lists objects and their outgoing references, showing how objects are connected and retained in memory. It also covers how Log4j must be configured for proper cleanup in web applications to avoid issues.
62. Using Log4j 2 in Web Applications
You must take particular care when using Log4j or any other logging framework within a Java EE web application.
It's important for logging resources to be properly cleaned up (database connectionsclosed, files closed, etc.)
when the container shuts down or the web application is undeployed. Because of the nature of class loaders within web applications,
Log4j resources cannot be cleaned up through normalmeans. Log4j must be "started" when the web application deploys and "shut down"
when the web application undeploys. How this works varies depending on whether your application is
a Servlet 3.0 or newer or Servlet 2.5 web application.
In either case, you'll need to add the log4j-web module to your deployment as detailed in the Maven, Ivy, and Gradle Artifacts manualpage.
To avoid problems the Log4j shutdown
hook will automatically be disabled
when the log4j-web jar is included.