The Lucee Installer does not come with ability to rotate logs built into it. Instead, the Lucee installers ship with Tomcat's default logging mechanism, java.util.logging. This is simple and effective logging that will work in most situations, but if you want more complex features, such as rotation based on date or size, you will need to upgrade Tomcat to use a more advanced logging mechanism, such as Log4j.
Thankfully, upgrading to log4j is NOT DIFFICULT. Download a couple things here, tweak a config file there, and you're all set.
The following is intended to be a guide on how to go about downloading and installing log4J on a system that was built using the Lucee Installers.
Review the Log4j Docs (optional)
Much of the following is adapted from the Log4j documentation, which, if you want to review the original, can be found here.
Installing Log4J Walkthough
The following guide will assume you've installed Lucee to the default location of /opt/lucee, and the directories stated here will be written accordingly. If you installed Lucee to a different location, you will need to update the example directories to match where you installed Lucee.
In the following example, I will be upgrading a Lucee 5 installation on Ubuntu 18.04 LTS. If you're not running this setup (or if you're running on Windows), you may need to interpolate these commands a bit, but the general principals will be the same.
Create the log4j directories
Start out by creating the directories that we'll need for our log4j files. I used the default directories when I installed Lucee with the Lucee installer, so our $CATALINA_HOME value will be /opt/lucee/tomcat/. Using this directory as a base, we now need to create our log4j directories:
Create a new directory in
Download and Extract the Log4j JARs
Now that we have the directories we need, we will want to download and extract the log4j JAR's into the lib directory. The download page is here. At the time of this writing, the most recent version is 2.12.1, so that's what I'll download and extract in this example:
The last line just ensures the 3 files you need were copied properly.
Create the Log4j Config File
There are several formats that we can use for our Log4j2 config file, but for our purposes, we'll be using XML at the moment. Here is an example XML file that is a good place to get started:
Update the Classpath to load
Now that the files and configs are in place, we just need to load the Log4j JAR's at startup. We can do that by adding the following line to the setenv.sh file in the tomcat/bin directory:
For Windows, you can add this line to the "Java Classpath" text field in the "Java" tab of the Lucee Tomcat Service Control.
As an example, my setenv.sh file now looks like this:
Restart to finish up
Restart Tomcat so that the new logger takes affect:
You should see new logs (like catalina.log instead of catalina.out) appear in your