Logging application information

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)