I use log4php to write file logs. Here is the configuration file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns="http://logging.apache.org/log4php/">
<appender name="default" class="LoggerAppenderDailyFile">
<layout class="LoggerLayoutPattern">
<param name="conversionPattern" value="%date %logger %-5level %msg%n" />
</layout>
<param name="file" value="/path/to/log/register-%s.log" />
<param name="datePattern" value="Y-m-d" />
<param name="append" value="true" />
</appender>
<root>
<level value="info" />
<appender_ref ref="default" />
</root>
</configuration>
And here is the initialization codes in PHP :
require_once('/path/to/log4php/Logger.php');
require_once('/path/to/log4php.xml');
$logger = Logger::getLogger(basename(__FILE__));
$logger->info('Testing');
the folder permission is set to 777 ( it's a Ubuntu Linux server ), but the log file didn't create. How do I debug the log4php?
Logger::configure('/path/to/log4php.xml');instead of require?Logger::configure('/path/to/log4php.xml');insead of require just before calling$logger = Logger::getLogger(basename(__FILE__));and i got log written successfully. What does error_logs say?Logger::configure(base_path().'/config.xml');and in config.xml:<param name="file" value="app/storage/logs/log.ERROR.log" />My application is deployed on Amazon EC2 and I grant the permission to storage directory as follows:sudo chmod -R 777 app/storageBut still the log file is not created. How can I check that what's the issue?