# Setting up logging

The Discovery Framework uses the Apache log4j logging utility.

Liferay's primary log configuration is managed in portal-log4j.xml file (which is packed inside portal application's WEB-INF/lib/portal-impl.jar). As with many other configuration files, Liferay provides administrators with a second configuration file, portal-log4j-ext.xml, which can be used to override settings in the main portal-log4j.xml file.

Both of these files are in standard log4j XML configuration format. Both files allow creating and modifying appenders, binding appenders to loggers, and adjusting the default log verbosity of different classes/packages. By default, the Endeca override file specifics a log verbosity of INFO for the com.endeca and com.endeca.portal.instrumentation packages. Endeca does not override any of the default log verbosity settings specified for non-Endeca components packaged in portal-log4j.xml.

The Endeca log configuration specifies three appenders. The main root logger prints all messages to two locations: the console, which is typically redirected to the application server's output log (catalina.out in Tomcat and SystemOut.log in WAS), and a file called df.log. That file is specified relative to the working directory. If not adjusted, the df.log file can typically be found in one of the following locations:

1. If Tomcat was started by running the startup.bat or startup.sh script, the log is found wherever the script was run. For example, if you navigate to tomcat-<version>/bin and execute the startup script, your logs appear in tomcat-<version>/bin/df.log.
2. If Tomcat was registered and started as a Windows service, the log files may be located in C:\Windows\System32\df.log or C:\Windows\SysWOW64\df.log.
3. If Tomcat is a server inside of Eclipse, the log files may be located in the root of the Eclipse directory (such as C:\eclipse\df.log).
4. If running WAS 6.1 or 7, the log files may be located relative to the profile's working directory (such as /localdisk/WAS/AppServer/profiles/AppSrv01/df.log).

In addition to the console and df.log appenders, Endeca also provide a second file appender for capturing metrics logging. This appender creates a file called df-metrics.log, which is generated in the same location as df.log. All log entries produced by classes in com.endeca.portal.instrumentation are routed to df-metrics.log—they are not printed to the console or to df.log. By keeping performance information separate, administrators can easily distinguish server logs from performance logs, and can easily run analysis scripts on the performance logs.

Note: For further details on log4j logging in Liferay, see the Liferay Portal Administrator's Guide.