CodeIgniter Forums
Only show Info Messages - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Only show Info Messages (/showthread.php?tid=29138)



Only show Info Messages - El Forum - 03-30-2010

[eluser]nZac[/eluser]
I am looking to make it so that ONLY informational messages show up in my logs. Is this possible?


Only show Info Messages - El Forum - 03-31-2010

[eluser]OliverHR[/eluser]
In aplication/config/config.php Set value to 3

Code:
$config['log_threshold'] = 3;



Only show Info Messages - El Forum - 03-31-2010

[eluser]nZac[/eluser]
OliverHR,

I tried that but it also shows everything less than a level 3. IE: DEBUG and ERROR messages. The problem is I don't need DEBUG messages, just INFO and ERROR.

Ideas?


Only show Info Messages - El Forum - 04-01-2010

[eluser]rogierb[/eluser]
You could extend the Log class and rewrite the $this->_levels to just include errors and info's

Basically all you would need to do is change the order of the array so error and info are the first two numbers


Only show Info Messages - El Forum - 04-01-2010

[eluser]nZac[/eluser]
Rogierb,

I will try that and post some code.

Thanks for the idea.


Only show Info Messages - El Forum - 07-30-2010

[eluser]joelrichard[/eluser]
Before I begin, I will admit that I am a CI newbie, but experienced in web development otherwise.

I would argue that the log_threshold values in the config.php are out of order in terms of how much log entries they produce. To refresh our memories, the order is defined as such:

Code:
0 = Disables logging, Error logging TURNED OFF
1 = Error Messages (including PHP errors)
2 = Debug Messages
3 = Informational Messages
4 = All Messages

So to get just INFO messages, which are normally rare and few, you need to also get error and debug. I would argue that the order should be as follows:

Code:
0 = Disables logging, Error logging TURNED OFF
1 = Error Messages (including PHP errors)
2 = Informational Messages
3 = Debug Messages
4 = All Messages

(Swap debug and info)

Then you can set your level to 2, get info and error messages and not have your log files totally spammed by the debug message. Remember, CI's own documentation says:

Quote:"CodeIgniter doesn't natively generate any info messages but you may want to in your application."

But in order for us to get those messages, we have to get all the debug messages, too. Am I making sense here?

Also, it seems to me that the descriptions of the values are 3 and 4 are redundant. By getting 3, you get everything at 2 and 1 as well. 4 is meaningless in this sense, unless there's something here that I don't understand.

So, how does one go about proposing a change to the code igniter system code? Smile

--Joel

P.S. For the record, I have not found an adequate solution to this. I found a site that has a small hack that changes the log_threshhold from a "less-than" comparison to an "equals" comparison in which case, I can get either ERROR or INFO, but not both. which is not what I want.