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 Tomcat Guide (optional)
Much of the following is just a customized from of the Tomcat 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 16.4 LTS. If you're not running this setup, you may need to interpolate these commands a bit, but the general principals will be the same.
Create the log4j.properties file
Start out by creating a standard config file. This config file will force the majority of relevant logging info to be logged in the catalina.out file. When we're done, other log files will be created, but they should not contain any actual information with the exception of a single line on occasion.
Create a new text file in
Then add the following text to it:
At the time of this writing, log4j 2.0 beta is available, but the Tomcat documentation for log4j (link above) says that Tomcat requires the 1.2.x version, which can be found in the archived versions here:
log4j-1.2.17.jar file to
/opt/lucee/tomcat/libdirectory, and you're done with this step.
Download Tomcat Extras
There are two additional JAR's Tomcat will need in order to use Log4j, these are
tomcat-juli-adapters.jar These are "extras" that the Tomcat project keeps up to date and provides downloads for. You can download these two files from the Tomcat download page, under "Extras":
Set the Context Log Attribute
We will need to update the default context config so that logging data is "trapped" and placed in the default root logger. In order to do this, we need to edit the default context file in
In that file, we need to update this line:
Cleanup and Restart
Last, we need to remove the previous logging.properties file as Tomcat will still read that and create empty log files if we do not remove it. Just delete it or rename it if you want to keep it around for some reason.
I would also recommend that you clean out the previous logs from the
/opt/lucee/tomcat/logs/directory. To do this, just stop the Lucee service, delete the logs, then start it again. This will make verifying your config much easier, as you can see at a glance if your new logging config has taken effect.
Verify Your Config
Once you've restarted Tomcat. Check your log directory and ensure that the bulk of the log data is now being stored in your catalina.out file. An example resulting log directory can be seen in the image below.
Note that all useful log data is being directed to the catalina.out file.