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/02/10 11:55] ravith |
dev:logginevent [2009/07/06 20:36] (current) |
||
---|---|---|---|
Line 2: | Line 2: | ||
---- | ---- | ||
- | **//'' | + | **//'' |
Line 8: | Line 8: | ||
**//'' | **//'' | ||
- | This unit is used for auditing/ | + | This unit is used for auditing/ |
- | g values through the functions provided here. Currently there are 3 types of auditing levels for Sahana 2. | + | |
- | * 0 - no logging. | + | <code php> |
- | * 1 - basic level logging. | + | |
- | * 2 - security level logging. | + | |
+ | $details=null, | ||
+ | $log_level=INFO, | ||
+ | $sensitivity_level=NOT_SENSITIVE, | ||
+ | $date_time=null, | ||
+ | $module=null, | ||
+ | $action=null, | ||
+ | array $extra_opts=null | ||
+ | )</ | ||
- | Default is 1 and it logs basic information, | + | Parameter description. \\ |
- | 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 | + | |
- | nnect to these databases. | + | * **'' |
+ | * **'' | ||
+ | * **'' | ||
+ | * **'' | ||
+ | * **'' | ||
+ | * **'' | ||
+ | * **'' | ||
+ | * **'' | ||
- | **//'' | + | **There are five levels of logging, namely** |
- | {{logger.png}} | + | |
- | \\ 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); | + | * **INFO** |
+ | * **DEBUG** | ||
+ | * **WARN** | ||
+ | * **ERROR** | ||
+ | * **FATAL** | ||
- | | + | **__//'' |
+ | The log level defaults to **INFO**. \\ | ||
+ | |||
+ | **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 60: | 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.// |