Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable logging in Codeigniter?

How can I disable logging in CodeIgniter?

My application has 3 applications and my first 2 applications' logs are written into the common logs directory. So it has become difficult to maintain the log files.

So please help me in writing the logs in the other preferable locations in my application or help me disable logging.

like image 473
gowtham kumar Avatar asked Sep 16 '11 10:09

gowtham kumar


People also ask

How to disable error log in CodeIgniter?

No need to type a long query to disable error reporting in codeigniter. Use error_reporting(0); in the page to disable displaying errors in that page.


2 Answers

Logging can be configured per application, it's done in

/application/config.php

The setting in question is $config['log_path'].

If you want to disable logging, set the threshold to 0:

$config['log_threshold'] = 0;

But I wonder a bit if you have three applications why they log into the same log folder. Each application should have it's own log folder.

like image 199
hakre Avatar answered Oct 21 '22 02:10

hakre


Take a look in index.php for each application:

/*
 * -------------------------------------------------------------------
 *  CUSTOM CONFIG VALUES
 * -------------------------------------------------------------------
 *
 * The $assign_to_config array below will be passed dynamically to the
 * config class when initialized. This allows you to set custom config
 * items or override any default config values found in the config.php file.
 * This can be handy as it permits you to share one application between
 * multiple front controller files, with each file containing different
 * config values.
 *
 * Un-comment the $assign_to_config array below to use this feature
 *
 */
    // $assign_to_config['name_of_config_item'] = 'value of config item';

I've never personally used this, but it seems to suggest that each separate app can override the settings in config.php using a shared application. So you should be able to do something like this in each individual index file:

$assign_to_config['log_threshold'] = 0;
// OR
$assign_to_config['log_path'] = 'app3/logs/';
like image 39
Wesley Murch Avatar answered Oct 21 '22 01:10

Wesley Murch