The linux-log4php prompts during use that the configuration file cannot be loaded

Source: Internet
Author: User
The following is a line of nginx error logs. for ease of viewing, I have separated them: {code ...} overview 1. use Logger: getRootLogger to call Logger. at the entrance, reference Log4php and Logger. configure (& #039; * & #039;) load. 2. this problem has not occurred before. I suspect it is...

The following is a line of nginx error logs. to facilitate viewing, I have separated them:

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 configuration. in /alidata1/****/configurators/LoggerConfiguratorDefault.php on line 475" while reading response header from upstream, client: 101.226.103.72, server: ****, request: "POST /share/notify HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "*****"

Overview

1. use Logger: getRootLogger to call Logger. Reference Log4php at the entrance, and Logger. configure ('*') Load.

2. this problem has not occurred before. I suspect it is because I have adjusted the nginx permission once. Previously, nginx users were apache and now I changed it to nobody. (But there is no reason for this suspicion. I have restarted nginx for countless times)

3. in this case, it is good or bad. sometimes I can use Logger to print the output normally, but most of the time I will report the above error. (This also indicates that the configuration file permission is correct ). I sometimes restart php-fpm, but it doesn't feel any contact. The work process of php-fpm is also nobody permission

I have confirmed that this can be ruled out.

1. the file exists, and the file permission is already 777. (even the permissions in the file path have been changed to 777)

Who has encountered the same problem? I have now called Logger. configure () at the entrance to specify the calling file. why is the above error? let's take a look.

Reply content:

The following is a line of nginx error logs. to facilitate viewing, I have separated them:

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 configuration. in /alidata1/****/configurators/LoggerConfiguratorDefault.php on line 475" while reading response header from upstream, client: 101.226.103.72, server: ****, request: "POST /share/notify HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "*****"

Overview

1. use Logger: getRootLogger to call Logger. Reference Log4php at the entrance, and Logger. configure ('*') Load.

2. this problem has not occurred before. I suspect it is because I have adjusted the nginx permission once. Previously, nginx users were apache and now I changed it to nobody. (But there is no reason for this suspicion. I have restarted nginx for countless times)

3. in this case, it is good or bad. sometimes I can use Logger to print the output normally, but most of the time I will report the above error. (This also indicates that the configuration file permission is correct ). I sometimes restart php-fpm, but it doesn't feel any contact. The work process of php-fpm is also nobody permission

I have confirmed that this can be ruled out.

1. the file exists, and the file permission is already 777. (even the permissions in the file path have been changed to 777)

Who has encountered the same problem? I have now called Logger. configure () at the entrance to specify the calling file. why is the above error? let's take a look.

Solution
Thanks for this article. please click to view

This section briefly introduces 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.