Yii Framework Forum: Logging application information - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Logging application information log the queries and other information into particular file Rate Topic: -----

#1 User is offline   ps_sach 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 79
  • Joined: 07-December 09

Posted 13 March 2010 - 01:42 AM

Hi there,

I want to log my application queries and some other information into specified files at specified location

I would like to have different files for different modules and in the file I can log sql queries, debug msg etc.

As my application is web application and i want to use CFileLogRoute for logging i get something like this ->

My Controller name is TestController and in that controller there is an action with name update and Code is like this


   $logger = new CFileLogRoute;    
   $logger->setLogPath("/home/Workspace/Logger/");                         
   $logger->setLogFile("testLogger.log");
   Yii::log("This is login History", "info", "application"); 

  


But it's not working for me.
I want string "This is is Login History" should go into testLogger.log file which is in "/home/Workspace/Logger/" directory

Thank you!
0

#2 User is offline   vamp 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 181
  • Joined: 30-January 09

Posted 13 March 2010 - 05:31 AM

View Postps_sach, on 13 March 2010 - 01:42 AM, said:

Hi there,

I want to log my application queries and some other information into specified files at specified location

I would like to have different files for different modules and in the file I can log sql queries, debug msg etc.

As my application is web application and i want to use CFileLogRoute for logging i get something like this ->

My Controller name is TestController and in that controller there is an action with name update and Code is like this


   $logger = new CFileLogRoute;    
   $logger->setLogPath("/home/Workspace/Logger/");                         
   $logger->setLogFile("testLogger.log");
   Yii::log("This is login History", "info", "application"); 

  


But it's not working for me.
I want string "This is is Login History" should go into testLogger.log file which is in "/home/Workspace/Logger/" directory

Thank you!


try to add next code to "components" section of your main.php (configuration):
	'log'=>array(
		'class'=>'CLogRouter',
		'routes'=>array(
			array(
				'class'=>'CFileLogRoute',
				'levels'=>'trace warning error info profile',
				'enabled'=>true,
				'logFile'=>'mycustomfile.log',
			),
		),
	),


and then specify "categories" section of your CFileLogRoute (+check documentation)
-Posted Image-
Thanks, you make me stronger!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users