Logs

Logs
This appendix contains the following sections:
About Logs
ActiveGrid uses loggers in the following three ways:
The list of ActiveGrid loggers is in List of ActiveGrid-Defined Loggers.
You can configure the loggers for a particular logging environment (for example, IDE or Test Runs) by editing the configuration file for that logging environment. Configuration files control what is logged and where the output goes and how the output is formatted. See Configuring Logging Environments for more information.
Logging Systems for Python and PHP
For Python applications, ActiveGrid uses the Python logging facility. Since PHP does not have a logging system, ActiveGrid uses an open source package for PHP, called log4php.
In both Python and PHP what places you can log is controlled by the type of log appender you use (in Python these are called handlers):
For ActiveGrid applications, we often want to log to the Apache log file or to where the php.ini (PHP's initialization file) directs PHP's own logging. In Python, the log appender (handler) you use for this is called activegrid.util.loghandlers.ApacheHandler. This handler is used in the pyRunLog.ini file to direct logging to the Apache log file.
In PHP, the appender you use for this is called LoggerAppenderApacheLog. This appender is included in the ActiveGrid redistribution of log4php. It directs logging to the error_log configuration parameter in the php.ini file.
Configuring Logging Environments
ActiveGrid uses a logging facility in the following different environments:
Each environment has a corresponding configuration file that controls what is logged, where the logging output is sent, and how it is formatted. The following table lists the configuration files.
 
Directs logging to the file "ide.log". The ide.log appears in the same directory as the logging configuration file.
Test Run (Python Applications)
Directs logging to stderr and to the file "testrun.log". The testrun.log file appears in the same directory as the ide.log.
Test Run (PHP Applications)
Directs logging to the PHP error log location as specified in your php.ini file via the "error_log" configuration parameter. The installed php.ini directs this to "phptestrun.log" in the same directory as the phpTestRunLog.ini file.
Server (Python Applications)
Server (PHP Applications)
Server and Test Run (PHP Applications)
If a logging configuration file cannot be found, then the logging system is setup with a default configuration that logs all messages of level WARN or higher to stderr in the case of Python (or stdout if running under Apache) and to the location specified in the php.ini's error_log parameter in the case of PHP.
Location of ActiveGrid Logging Configuration Files
The default location of the logging configuration files depends on whether you’re running ActiveGrid on a Windows or UNIX operating System. Whatever operating system you’re using, you can override the default location of the logging configuration files by setting the appropriate environment variable.
Configuration Files for IDE and Test Run Environments
For the IDE and test run environments the logging configuration files are found in:
%HOMEDRIVE%%HOMEPATH%\MYDOCU~1\ActiveGrid\logs
For example:
My Documents\ActiveGrid\logs
The php.ini file is located in:
%HOMEDRIVE%%HOMEPATH%\MYDOCU~1\ActiveGrid\
For example:
My Documents\ActiveGrid
~\ActiveGrid\logs
Files for Server Environment
For deployed server runs, the logging configuration files are found in:
${ACTIVEGRID_SERVER_HOME}/local/logs
The location of the php.ini file is specified in the "PHPIniDir" Apache directive in httpd.conf. This defaults to:
INSTALL_DIR/local/conf
Note: If the environment variable ACTIVEGRID_SERVER_HOME is not set, the logging configuration files are located in the logs directory in the ActiveGrid installation directory. If you choose to override the php.ini file location with this environment variable, be sure to edit the httpd.conf file accordingly.
Changing Location of Logging Configuration Files
You can change the location of the logging configuration files by setting environment variables. The environment variables, if specified, should specify the pathname for a logging configuration file.
 
 
Controls Logger configuration when running Python applications from the IDE.
Controls Logger configuration when running PHP applications from the IDE.
 
By default, the ActiveGrid logging configuration file sends logging output to the Standard Error device. You can modify the configuration file to send it to other devices or to have output go to multiple devices.
ActiveGrid Logger Naming
The names of all ActiveGrid loggers start with "activegrid." and follow the usual convention of naming following module and class. Loggers used for debugging have an additional node following the class node identifying what type of behavior is being logged. Also when used to control behavior the second node of the name of the logger is "config". The next node in the name identifies the general area to which it applies as follows:
 
List of ActiveGrid-Defined Loggers
The loggers available in each environment and their usage are described in the following table. The loggers available for test run of an ActiveGrid application through the ActiveGrid Studio and for deployed applications are the same and are referred to collectively simply as "runtime".
 
General purpose logger for miscellaneous internal debugging messages. Not much used as most debugging is controlled by special purpose loggers.
Configuration flag that controls whether and how errors encountered when converting XPath queries to SQL or Python expressions (such as when a user enters an expression in a search field) are reported.
level=DEBUG : throw exceptions on errors converting qualifications on SQL Xpath queries to code
Configuration flag that controls how much data is included in SQL statement logging statements. When activegrid.data.DataService.sql is set to the appropriate level SQL statements being executed are logged. Depending on the setting of activegrid.config.data.logValues the values for any placeholders in the SQL statement may also be logged as follows:
Logs information about the data services being managed by the ActiveGrid runtime such as when expired sessions are being removed.
Logs information about the use of XML Schemas such as schemas that are registered and Python or PHP classes created from their complex types.
Logs information about database connections being acquired.
Logs information about the ActiveGrid key generation service such as what keys it generates.
Objects used by the ActiveGrid runtime such as persistent objects obtained from the data service or objects obtained from the web service derive from the common super class ServiceObject. This logger logs information pertinent to the life cycle of these objects such as when they are instantiated, and state changes made to them.
Logs information about web services requests processed by the ActiveGrid runtime such as invoking a web service operation.
Logs information about the web server used for test runs, such as when it is started, and requests it handles.
Logs information about the Apache module (mod_python) responsible for the Python runtime environment within Apache.
 

ActiveGrid
Application Developer's Guide
Version 2.0