Differences
This shows you the differences between two versions of the page.
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/ | This unit is used for auditing/ | ||
- | shn_log_event($data_item_UUID=null, | + | <code php>shn_log_event( |
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | )</ | ||
- | There are five levels of logging, namely | + | Parameter description. \\ |
- | * INFO - Information | + | * **'' |
- | * DEBUG | + | * **'' |
- | * WARN - Warnings | + | |
- | * ERROR | + | * **'' |
- | * FATAL | + | * **'' |
+ | | ||
+ | | ||
+ | * **'' | ||
+ | * **'' | ||
- | 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 | + | **There are five levels of logging, namely** |
- | nnect to these databases. | + | |
+ | * **INFO** | ||
+ | * **DEBUG** | ||
+ | * **WARN** | ||
+ | * **ERROR** | ||
+ | * **FATAL** | ||
- | **//'' | + | **__//'' |
- | {{logger.png}} | + | The log level defaults to **INFO**. \\ |
- | \\ When a function calls a \u201clogger\u201d, | + | |
- | \u2019s being called from, as global variables. It also gets information such as userid and userlogid from the session. | + | |
- | Once it collects all the information, | + | |
- | is log level, it stores the values in the database. | + | |
- | shn_db_insert_array($message); | + | **There are nine levels of log sensitivity.** |
- | | + | * **PERSON_SENSITIVE** |
+ | * **ORGANIZATION_SENSITIVE** | ||
+ | * **LEAGALLY_SENSITIVE** | ||
+ | * **NATIONAL_SECURITY_SENSITIVE** | ||
+ | * **SOCIALLY_SENSITIVE** | ||
+ | * **DISASTER_MITIGATION_SENSITIVE** | ||
+ | * **SYSTEM_SENSITIVE** | ||
+ | * **NOT_SENSITIVE** | ||
+ | * **UNCLASSIFIED** | ||
+ | |||
+ | **__//'' | ||
+ | The senisitvity level defaults to **NOT_SENSITIVE** \\ | ||
- | The message can be chosen from predefined constants as specified in actions.inc, | ||
- | l. | ||
**//'' | **//'' | ||
Line 65: | Line 85: | ||
**//'' | **//'' | ||
+ | The default method of logging (to file or to database) can be configured in the sysconf.inc under $conf[' | ||
+ | A custom logger can be created by extending the class Logger and overriding the log_message() function. | ||
- | **//'' | + | <code php> |
- | + | log_message( | |
- | **//'' | + | |
- | Handles Debug messages of Sahana. Especially meant for developers of the system, to be used at development time. Echos | + | |
- | debug messages to either screen or to a file. Can be updated through the configuration file. | + | |
+ | | ||
+ | | ||
+ | $datetime, | ||
+ | $module, | ||
+ | $action, | ||
+ | $ext_opt_str | ||
+ | ) | ||
+ | </ | ||
**//'' | **//'' | ||
- | | + | The logging API **MUST** be used in the following and similar instances, additionally the module developer is free to use it else where.\\ |
- | + | \\ | |
- | | + | |
- | + | * On a configuration change | |
- | where message | + | * On a important event in the business logic of the module |
- | + | * On an error | |
- | thus, a message | + | * On a security violation or suspicious action |
- | DEBUG: < | + | |
+ | The log messages should be recorded with the appropriate logging level, and sensitivity level, to make event audit more efficient. | ||
\\ | \\ | ||
**//'' | **//'' | ||
- | //Pradeeper// and //Mifan// of Sahana core team. | + | //Ravith Botejue.// |