ouhman
(Ouhman)
March 20, 2011, 5:06pm
1
Hi all,
I am wondering if it is currently possible to specify the trace level on a certain category?
For example:
Yii::log(‘Mailing for blabla started’, ‘info’, ‘mailing’);
…
I do not necessary want to have a trace on that particular category (If trace level is set to 3 by default). Is there any way to do that?
Cheers
ouhman
(Ouhman)
March 21, 2011, 11:02am
2
hum anyone got the same issue?
zaccaria
(Matteo Falsitta)
March 21, 2011, 11:20am
3
Check the properties of Clogrouter
ouhman
(Ouhman)
March 21, 2011, 11:39am
4
I cant see anywhere how to achieve what I want to do in the CLogRouter doc page.
Basically when I log something with a particular category, I do not want to have a stack trace (if it set to 3 levels), I just want one line like:
"Starting job blabla at 13:30"
"Processing data 1 at 13:31"
etc etc
zaccaria
(Matteo Falsitta)
March 21, 2011, 11:55am
5
You can route the cateagory you want to cfilelogrouter, so you will get a log file for only one category.
ouhman
(Ouhman)
March 21, 2011, 12:16pm
6
Yeah I have already done something similar to:
'log'=>array(
'routes'=>array(
'class'=>'CFileLogRoute',
'levels'=>'trace, info',
'logFile'=>'cron.log',
'categories'=>'cron',
),
)
So all of my
Yii::log('blabla', 'info', 'cron');
are going to the right file, the issue is that when I call Yii::log(), it writes 3 lines (the number of the stack level set), and I just want one line to be written. (if that makes sense?)
mikl
(Mike)
March 22, 2011, 7:54am
7
ouhman
(Ouhman)
March 22, 2011, 9:42am
8
Hello Mike,
Thanks for your answer, I tried to set the constant YII_TRACE_LEVEL to 0 before the call to Yii::log() for that particulary category, but as it set in the bootstrap (index.php) and as I still want to log error with a trace level of 3 it didnt work.
So I had to build my own class to log it which is quite confusing really.
mikl
(Mike)
March 22, 2011, 11:10am
9
ouhman:
Hello Mike,
Thanks for your answer, I tried to set the constant YII_TRACE_LEVEL to 0 before the call to Yii::log() for that particulary category, but as it set in the bootstrap (index.php) and as I still want to log error with a trace level of 3 it didnt work.
So I had to build my own class to log it which is quite confusing really.
Did you read the guide carefully? You can’t change YII_TRACE_LEVEL, it’s a constant:
ouhman
(Ouhman)
March 22, 2011, 11:38am
10
Sure.
Sorry, not sure my issue has been understood.
What I am trying to do is logging some information for a particular category without having a trace level. But on the other hand continue to log normal error, warning with a trace level
So it sounds like this is not possible currently.
ouhman:
Sure.
Sorry, not sure my issue has been understood.
What I am trying to do is logging some information for a particular category without having a trace level. But on the other hand continue to log normal error, warning with a trace level
So it sounds like this is not possible currently.
has a solution for this been found yet? I also want to include a stack trace while in development mode on most but not all log-messages.
IMHO this should not be a constant, but a setting of CLogRoute.
ouhman
(Ouhman)
August 17, 2011, 1:25pm
12
I just ended up writing my own class to do so and problem solved.
Shame though that such functionality is not here on Yii )
Sigh. I have been hearing I gave up a bit too often.
Okay, thanks anyway! Guess i’ll just ignore those messages till it is ready for production.