linux-log4php during use: The configuration file could not be loaded

Source: Internet
Author: User

Below is a row of Nginx error logs, for ease of viewing, I made a separation:

  016/08/14 14:34:49 [ERROR] 2819#0: *59 FastCGI sent in stderr: "PHP message:php Warning:log4php:Configuration failed. Error loading configuration file:failed to load external entity "/alidata1/****/logger_conf.xml" Using default Configurat Ion. in/alidata1/****/configurators/loggerconfiguratordefault.php on line 475 "and reading response header from upstream, C lient:101.226.103.72, Server: * * *, Request: "Post/share/notify http/1.1", Upstream: "fastcgi://127.0.0.1:9000", Host: "* * * *"  

Description

1. Use Logger::getrootlogger call, at the entrance, reference log4php, while Logger.configure (' * ') to load.

2. This problem has not occurred before, I suspect it is because I adjusted the permissions of the Nginx problem, the previous Nginx user is Apache, now I changed into a nobody. (But this suspicion has no basis, I have restarted countless nginx)

3. This situation is good and bad, sometimes I can normally use logger to print output, but most of the time will report the above error. (This also indicates that profile permissions are not a problem from the side.) I reboot php-fpm sometimes good, but there is a lot of relationship, feeling no connection. PHP-FPM's work process is also nobody permissions

I've confirmed that I can rule out the situation.

1. 文件确实存在,文件的权限已经是777.(甚至文件路径中权限我都修改成了777)

Who has encountered the same problem, I now call at the entrance logger.configure () to specify the calling file, why the above error, we help to see

Reply content:

Below is a row of Nginx error logs, for ease of viewing, I made a separation:

  016/08/14 14:34:49 [ERROR] 2819#0: *59 FastCGI sent in stderr: "PHP message:php Warning:log4php:Configuration failed. Error loading configuration file:failed to load external entity "/alidata1/****/logger_conf.xml" Using default Configurat Ion. in/alidata1/****/configurators/loggerconfiguratordefault.php on line 475 "and reading response header from upstream, C lient:101.226.103.72, Server: * * *, Request: "Post/share/notify http/1.1", Upstream: "fastcgi://127.0.0.1:9000", Host: "* * * *"  

Description

1. Use Logger::getrootlogger call, at the entrance, reference log4php, while Logger.configure (' * ') to load.

2. This problem has not occurred before, I suspect it is because I adjusted the permissions of the Nginx problem, the previous Nginx user is Apache, now I changed into a nobody. (But this suspicion has no basis, I have restarted countless nginx)

3. This situation is good and bad, sometimes I can normally use logger to print output, but most of the time will report the above error. (This also indicates that profile permissions are not a problem from the side.) I reboot php-fpm sometimes good, but there is a lot of relationship, feeling no connection. PHP-FPM's work process is also nobody permissions

I've confirmed that I can rule out the situation.

1. 文件确实存在,文件的权限已经是777.(甚至文件路径中权限我都修改成了777)

Who has encountered the same problem, I now call at the entrance logger.configure () to specify the calling file, why the above error, we help to see

Solution to the problem
Thanks for this article, please click to view

Briefly describe the cause of the problem: The introduced class contains this function: Libxml_disable_entity_loader

My log4php.properties.

log4php.rootLogger=INFO, stderr, stdout, filelog4php.appender.stdout=LoggerAppenderConsolelog4php.appender.stdout.layout=LoggerLayoutPatternlog4php.appender.stdout.layout.ConversionPattern=%date{ISO8601} [%p] %m%nlog4php.appender.stdout.threshold=INFOlog4php.appender.stderr=LoggerAppenderConsolelog4php.appender.stderr.layout=LoggerLayoutPatternlog4php.appender.stderr.target=stderrlog4php.appender.stderr.threshold=ERRORlog4php.appender.stderr.layout.ConversionPattern=%date{ISO8601} [%p] [%l] %m%nlog4php.appender.file=LoggerAppenderDailyFilelog4php.appender.file.layout=LoggerLayoutPatternlog4php.appender.file.threshold=ERRORlog4php.appender.file.file=commands/logs/%s-error.loglog4php.appender.file.layout.ConversionPattern=%date{ISO8601} [%p] [%l] %m%n

PHP initialization

\Logger::configure(__DIR__ . '/log4php.properties');$logger = \Logger::getLogger('default');$logger->info('xxx');
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.