We can enable/disable logger using configuration
settings/configuration/logger.php. We can also specify where log should stored and how log file should be rotated.
enable setting we can enable or disable logger within our application. Value should be boolean. When logger is disabled, trying log message results in an exception.
Log to file or database
We can store in log in file or database, this can done by setting
type. Value of this setting can be
Log location file
path setting to set path where log messages should be logged. Here path must be directory.
path setting is applicable for log type
Log location DB
db contains setting to log messages in db. This is applicable only when log type is
db. See below settings
|connection||Database connection name. Keep it
|table||Table name where log should be logged.|
Table strcture for log(MySQL database):
CREATE TABLE `RequestLog` ( `requestLogId` bigint(20) NOT NULL AUTO_INCREMENT, `type` varchar(255) DEFAULT NULL, `message` text, `createdAt` datetime DEFAULT NULL PRIMARY KEY (`requestLogId`) ) DEFAULT CHARSET=latin1
Logging all logs into one files results in big file. Log file should be rotated date, week or monthly. Means there shoulld new log file after some duration. Nishchay allow to define this duration. Suppose if we set log to rotated to daily, then new log file will be created daily with file name as date in
Log rotation options.
|date||New log file will be created daily|
|week||New Log file will be created weekly and file name will date of first day of week.|
|biweek||To create log file every 15 days. File name will be for the first 15 day
|month||To create log file once a month and in this case log file name will be first date for month.|
Log files are created in
Y-m-d format only.
Notes are visible to you only and its for your use only. Its good to note a point of what you read.