0

I am working on Ubuntu (it use rsyslog), and I need to custom log some info with PHP. Here is my code:

openlog("mywebsite", LOG_PID | LOG_PERROR, LOG_LOCAL2);
syslog(LOG_WARNING, "mywebsite: 1000th visitor !");
closelog(); 

and I defined in /etc/rsyslog/rsyslog.d/50-default.conf :

local2.* /var/log/apache2/mywebsite.log

the file mywebsite is defined chmod 777 but nothing appears in mywebsite.log but still in error.log

I found out that it's because PHP doesn't recognize LOG_LOCAL2 or LOG_LOCAL0, in

openlog("mywebsite", LOG_PID | LOG_PERROR, LOG_LOCAL2);

I catch the error:

PHP Notice: Undefined variable: access in /var/www/default/public_html/index.php on line 6

despite it's defined in the offcial documentation: PHP Official manual for openlog()

PS: I am on PHP 5.3.10

How can I resolve this?

Pierre Lebon
  • 445
  • 1
  • 5
  • 12

0 Answers0