Introduction
You can control the amount of information a running LAS writes to the the log file ($TOMCAT_HOME/content/las/logs/las.log) to help you determine what's going wrong when you don't get the output you expect. The log files are rotated automatically so you can setup your own policy for deleting old log entries. By setting the logging level you can trace the progress of your request through the product server and the backend services. The log output can also include the values of some important variables (like database connection information and SQL statements) along the way.
Logging Levels
There are five logging levels.
-
debug -- write out lots messages at each step of the process
-
info -- write a log message for each product request and a message when a default value is used for the resource paths (this is the default)
-
warn -- write out a message if something is potentially harmful, but not enough to stop a request
-
error -- write out a message when a request fails
-
fatal -- presumably used if whole web app were about to fail. We don't use this level so setting to fatal essentially turns off all logging.
The levels are cumulative. Setting the level causes messages from that level and above to be written to the log. For example, the debug level gets all other message levels as well. The warn level gets only warn, error and fatal messages.
The Log Configuration File
Control of where the logs are written, how often they are rotated and what they contain can be found in the $TOMCAT_HOME/webapps/las/WEB-INF/classes/log4j.xml file. To change the logging level edit the file:
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
<appender name="las" class="org.apache.log4j.DailyRollingFileAppender"> <param name="File" value="/usr/local/tomcat/content/las/logs/las.log"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="LAS %d{yyyy-MM-dd'T'HH:mm:ss.SSS Z} %-5p - %c{1} - %m%n"/> </layout> </appender>
<logger name="gov.noaa.pmel.tmap.las" additivity="false"> <level value="INFO"/> <appender-ref ref="las"/> </logger>
<root> <level value="WARN"/> <appender-ref ref="las"/> </root>
</log4j:configuration>
and change the value of <level value="INFO"> to an appropriate level for your needs. You'll have to restart the server to activate the new logging level.
The log files are written and saved according to the Appender class. We ship LAS with so it uses the org.apache.log4j.DailyRollingFileAppender which means the logs get rotated daily. You can change the appender class and configure a different appender, but you'll have to study the Log4j documentation. You can easily change the name of the log file and the directory where it gets written by changing the value in the File param (<param name="File" value="/usr/local/tomcat/content/las/logs/las.log"/>).
Example Log Entries
When you run LAS with log level DEBUG it generates a tremendous amount of information, but it can be very helpful in seeing exactly where the system fails. And it's exactly what we'd likely as you to send us if we were looking to help you track down a problem with your installation.