Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
dev:logginevent [2007/10/11 07:58]
ravith
dev:logginevent [2009/07/06 20:36] (current)
Line 10: Line 10:
  This unit is used for auditing/logging purposes in Sahana2. If modules need auditing features, it is a matter of passing values through the functions provided here.   This unit is used for auditing/logging purposes in Sahana2. If modules need auditing features, it is a matter of passing values through the functions provided here. 
  
-shn_log_event($data_item_UUID=null,$comments,$details=null,$log_level=INFO,$sensitivity_level=NOT_SENSITIVE,$date_time=null,$module=null,$action=null,array $extra_opts=null)+<code php>shn_log_event( 
 +          $data_item_UUID=null, 
 +          $comments, 
 +          $details=null, 
 +          $log_level=INFO, 
 +          $sensitivity_level=NOT_SENSITIVE, 
 +          $date_time=null, 
 +          $module=null, 
 +          $action=null, 
 +          array $extra_opts=null 
 +)</code>
  
-There are five levels of logging, namely+Parameter description. \\
  
-  * INFO   - Information log records+   * **''data_item_UUID''** - The UUID of a data item which the log record is related to. (optional) 
-  DEBUG  Debugging log records+   * **''comments''** - A breif log messsage. (required) 
-  WARN   - Warnings +   * **''details''** A detailed log message(optional) 
-  ERROR  Errors +   * **''log_level''** - The log level 
-  FATAL  Fatal Errors+   * **''log_sensitivity''** - The sensitivity of this log message
 +   **''date_time''** - The date and time in the format returned by php date function - date("Y-m-d H:i:s"
 +   * **''module''** The name of the module, if not specified (if null) it will be determined from $global['module'] 
 +   * **''action''** - The name of the action, if not specified (if null) it will be determined from $global['action'] 
 +   * **''extra_opts''** - any extra options as an associate array. This array will be parsed in to key-value pairs in the form of <key>value</key> and will be recorded as text. \\ eg. Longitude, Latitude, etc.
  
-The log level defaults to INFO. 
-level 3 is good for Sahana administrators and developers who wants to fine tune the applications. The logging level can 
-be altered in the Sahana main configuration file under /conf directory. 
  
-Currently **//''logger.inc''//** runs with both MySQL and PostgreSQL and it uses ADO-DB database abstraction layer to co +**There are five levels of logging, namely**
-nnect to these databases.+
  
 +  * **INFO**   - Information log records.
 +  * **DEBUG**  - Debugging log records.
 +  * **WARN**   - Warnings
 +  * **ERROR**  - Errors
 +  * **FATAL**  - Fatal Errors
  
-**//''Desgin:''//** \\ +**__//''These levels are defined as constants in lib_log.inc''//__** \\ \\ 
-{{logger.png}} +The log level defaults to **INFO**. \\
-\\ When a function calls a \u201clogger\u201d, it gets information like ''date,time,action,log level'' and ''module'' it +
-\u2019s being called from, as global variablesIt also gets information such as userid and userlogid from the session. +
-Once it collects all the information, it determine the \u201clog level\u201d it has to use for auditing. Depending on th +
-is log level, it stores the values in the database.+
  
-            shn_db_insert_array($message);+**There are nine levels of log sensitivity.**
  
-    $message: Log message+   **PERSON_SENSITIVE** 
 +   * **ORGANIZATION_SENSITIVE** 
 +   * **LEAGALLY_SENSITIVE** 
 +   * **NATIONAL_SECURITY_SENSITIVE** 
 +   * **SOCIALLY_SENSITIVE** 
 +   * **DISASTER_MITIGATION_SENSITIVE** 
 +   * **SYSTEM_SENSITIVE** 
 +   * **NOT_SENSITIVE** 
 +   * **UNCLASSIFIED** 
 + 
 +**__//''These levels are defined as constants in lib_log.inc''//__** \\ \\ 
 +The senisitvity level defaults to **NOT_SENSITIVE** \\
  
-The message can be chosen from predefined constants as specified in actions.inc, or custom messages can be passed as wel 
-l. 
  
 **//''Usage:''//** \\ **//''Usage:''//** \\
Line 65: Line 85:
 **//''Name:''//** debug.inc **//''Name:''//** debug.inc
  
 +The default method of logging (to file or to database) can be configured in the sysconf.inc under $conf['default_logger']. \\The log messages will be printed as HTML if the configured logger cannot be created or not found. \\
 +A custom logger can be created by extending the class Logger and overriding the log_message() function.
  
-**//''Synopsis:''//** debug($message) +<code php> 
- +log_message( 
-**//''Description:''//** \\ +          $data_item_UUID=null, 
- Handles Debug messages of Sahana. Especially meant for developers of the systemto be used at development time. Echos +          $comments, 
-debug messages to either screen or to a file. Can be updated through the configuration file.+          $details=null, 
 +          $log_level
 +          $sensitivity_level, 
 +          $datetime, 
 +          $module, 
 +          $action, 
 +          $ext_opt_str 
 +
 +</code>
  
 **//''Usage:''//** \\ **//''Usage:''//** \\
- include inc/lib_logger/debug.inc +The logging API **MUST** be used in the following and similar instances, additionally the module developer is free to use it else where.\\ 
- + \\ 
-  debug($message); +  * When a write commit is made to the database 
- +  * On a configuration change 
-where message is the custom message passed +  * On important event in the business logic of the module 
- +  * On an error 
-thus, message of the form: +  * On a security violation or suspicious action
- DEBUG: <date><time><message> is echoed. +
  
 +The log messages should be recorded with the appropriate logging level, and sensitivity level, to make event audit more efficient.
 \\ \\
 **//''Author:''//** \\ **//''Author:''//** \\
-//Pradeeper// and //Mifan// of Sahana core team.+//Ravith Botejue.//

Navigation
QR Code
QR Code dev:logginevent (generated for current page)