Extending the scope of the maxFiles parameter in logging configuration in 25.0.0.7
In this release, the maxFiles
parameter in Open Liberty’s access logging configuration is enhanced. This change improves log file cleanup and helps ensure that all matching log files in the output directory are considered, not just those generated by the current process.
View the list of fixed bugs in 25.0.0.7.
Check out previous Open Liberty GA release blog posts.
Develop and run your apps using 25.0.0.7
If you’re using Maven, include the following in your pom.xml
file:
<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>3.11.4</version>
</plugin>
Or for Gradle, include the following in your build.gradle
file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'io.openliberty.tools:liberty-gradle-plugin:3.9.4'
}
}
apply plugin: 'liberty'
Or if you’re using container images:
FROM icr.io/appcafe/open-liberty
Or take a look at our Downloads page.
If you’re using IntelliJ IDEA, Visual Studio Code or Eclipse IDE, you can also take advantage of our open source Liberty developer tools to enable effective development, testing, debugging and application management all from within your IDE.
Enhancing Log Management in Open Liberty: Extending maxFiles in Access Logging
Open Liberty’s robust logging system allows developers and administrators to gain valuable insight into an application’s runtime behavior.
In this release, the maxFiles
parameter in Open Liberty’s access logging configuration is enhanced. This change improves log file cleanup and helps ensure that all matching log files in the output directory are considered, not just those generated by the current process.
Access logging in Open Liberty captures all inbound HTTP requests and records them in access log files. Various parameters for access logging can be configured using the server.xml
configuration file. One such parameter is maxFiles
, which controls how many rotated access log files the server retains.
Under the default behavior, Open Liberty’s cleanup mechanism only tracked and deleted access log files that were created during the current server runtime. As a result, older log files generated by previous server runs remained in the directory.
To address this, the scope of the maxFiles
parameter is extended. The key change is that the server now considers all log files matching the configured filename pattern in the log output directory, regardless of which process created them, and deletes the oldest ones if the total exceeds maxFiles
.
Benefits:
-
Improved Cleanup: Ensures the log directory remains tidy and within the expected limits.
-
Cross-process Awareness: Handles logs from previous runs.
-
Consistency: Makes log retention behavior predictable and reliable across deployments.
Here’s how to enable access logging with the maxFiles
parameter:
<httpEndpoint id="defaultHttpEndpoint" httpPort="9080" httpsPort="9443">
<accessLogging filepath="${server.output.dir}/logs/http_versionEndpoint_access.log"
maxFiles="5" rolloverInterval="1m" />
</httpEndpoint>
This setup will:
-
Store access logs in the
${server.output.dir}/logs
directory. -
Retain only the 5 most recent rotated log files.
-
Automatically delete the oldest file when a new one is created, once the count exceeds 5.
Get Open Liberty 25.0.0.7 now
Available through Maven, Gradle, Docker, and as a downloadable archive.