Welcome Guest, Not a member yet? Register   Sign In
How to clear/reset/erase logfile?
#1

[eluser]Unknown[/eluser]
I have googled and searched the forums and can't find any reference to something that seems basic - how to clear the logfile?
I tried just erasing it - it came back with all the content.
#2

[eluser]Samus[/eluser]
[quote author="lesatglsi" date="1333903037"]I have googled and searched the forums and can't find any reference to something that seems basic - how to clear the logfile?
I tried just erasing it - it came back with all the content.[/quote]
it's most likely because you have your error logging to log all messages.

in your application/config/config.php file

find something like this and make it 0 instead of 4 or whatever number it is.

$config['log_threshold'] = 4;
#3

[eluser]cPage[/eluser]
My suggestion...
Code:
public function reset_logs()
{
$this->load->helper('file');
delete_files(APPPATH.'logs/');
$default_403_forbidden = file_get_contents(APPPATH.'index.html');
write_file(APPPATH.'logs/index.html', $default_403_forbidden);
}
#4

[eluser]Samus[/eluser]
[quote author="cPage" date="1333908805"]My suggestion...
Code:
public function reset_logs()
{
$this->load->helper('file');
delete_files(APPPATH.'logs/');
$default_403_forbidden = file_get_contents(APPPATH.'index.html');
write_file(APPPATH.'logs/index.html', $default_403_forbidden);
}
[/quote]
This approach won't help if he has $config[‘log_threshold’] = 4; set to 4. As CI will just rewrite the log file every time he loads one of his pages
#5

[eluser]cPage[/eluser]
if you dont want anything in logs/ set $config[‘log_threshold’] to 0.

Code:
$this->config->set_item('log_threshold', 0);

so...

Code:
$this->config->set_item('log_threshold', 0);
$this->reset_logs();

should work.
#6

[eluser]Unknown[/eluser]
What I'm trying to do is start each test run with a clean log.
Yes, I do have log_threshold set to 4 (info)
#7

[eluser]Samus[/eluser]
[quote author="lesatglsi" date="1333933324"]What I'm trying to do is start each test run with a clean log.
Yes, I do have log_threshold set to 4 (info)[/quote]
Then set it to 0.

Every time you load a page in CI, it will fill your log file with log information.




Theme © iAndrew 2016 - Forum software by © MyBB