Logging

System and PHP errors are written to an application log file. For information on writing log messages or accessing log files, see Kohana Log methods.

The configuration settings for logging are accessible in the core configuration file config.php located in application/config. See Configuration for more information.

There are only two config settings for Logging:

/**
 * Log thresholds:
 *  0 - Disable logging
 *  1 - Errors and exceptions
 *  2 - Warnings
 *  3 - Notices
 *  4 - Debugging
 */
$config['log_threshold'] = 1;
 
/**
 * Message logging directory.
 */
$config['log_directory'] = APPPATH.'logs';

When log_threshold is set to 4 it will also log 3, 2 and 1, since lower levels are always included.

  • Level 1 is recommended in an production environment as it will only log errors.
  • Level 2 and 3 are used for custom logging by applications.
  • Level 4 is useful for debugging; it will log all libraries loaded and any errors.

Kohana by default, does not log anything to level 2 or 3.

$config['log_directory'] log file directory can be relative to application/ or absolute.

<box red |Important> Setting the level to 4 can slow down your application significantly. </box>

Note that these levels correspond to Kohana::log(level, message) calls as such:

  • 1 - 'error' (Errors & Exceptions)
  • 2 - 'alert' (Warnings)
  • 3 - 'info' (Notices)
  • 4 - 'debug' (Debugging)
general/logging.txt · Dernière modification: 20/02/2011 19:31 (modification externe)
CC Attribution-Noncommercial-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0