One very handy feature for Alfresco system administration is the alfresco service that is automatically installed on Linux environments. However, there is a catch when using this service, your various logs (e.g. alfresco.log, share.log, solr.log) can end up in the very root of your file system.
One partial workaround is to modify the various log4j configuration files and hardcode them to a specified location. However, there is a better way: edit the alfresco service.
By convention, I like logs to go somewhere sensible like /opt/alfresco/4.1.4/logs (or appropriate based on your Alfresco version). This folder doesn’t exist out of the box so you will need to create it. If choose another location, be sure to adjust the steps in this article accordingly.
Modify your service (e.g. /etc/init.d/alfresco – this depends on your Linux distribution) as follows:
First stop alfresco if it is currently running.
At the top of this script after RETVAL=0 add the following line (and adjust to match your installation path):
Change the start() command to go to your logs folder (make sure it exists) and then start the alfresco.sh script (which is one level above the logs folder). You could also use $ALF_HOME/alfresco.sh as a full path. Obviously adjust these lines to suit.
../alfresco.sh start “$2”
In the same way as start(), change stop() to do a similar thing:
../alfresco.sh stop “$2”
Near the end of the script there inside the case … esac statement also change the script as follows:
Clean up / move your old log files around as appropriate and then start alfresco. You should find all log files are now in the logs folder, without having to modify any of the delivered log4j configuration files.