Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ckan info level log go to error log file

Tags:

ckan

I installed Ckan from source on debian with apache following official doc and all it's ok but all ckan info logs are wrote to the error log file.

This is my virtualhost:

<VirtualHost *:80>
  ServerName ckan.mydomain.com
  ServerAlias ckan.mydomain.com
  WSGIScriptAlias / /etc/ckan/default/apache.wsgi

  # Pass authorization info on (needed for rest api).
  WSGIPassAuthorization On

  # Deploy as a daemon (avoids conflicts between CKAN instances).
  WSGIDaemonProcess ckan_default display-name=ckan_default processes=2 threads=15

  WSGIProcessGroup ckan_default

  ErrorLog /var/log/apache2/ckan_default.error.log
  CustomLog /var/log/apache2/ckan_default.custom.log combined

  <IfModule mod_rpaf.c>
      RPAFenable On
      RPAFsethostname On
      RPAFproxy_ips 127.0.0.1
  </IfModule>
</VirtualHost>

This is a line of my ckan_default.error.log:

<[Thu Oct 15 10:47:48.797562 2015] [:error] [pid 14100] 2015-10-15 10:47:48,797 INFO [ckan.lib.base] /ckan-admin render time 0.085 seconds>

Why is there [:error] and why is this line in ckan_default.error.log?

Thanks. Alex

like image 356
Almalerik Avatar asked Oct 20 '22 00:10

Almalerik


1 Answers

CKAN's default config simply sends logs to stderr, as can be seen in the ckan/config/deployment.ini_tmpl:

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

Apache saves stderr to its ErrorLog, hence why you see it in ckan_default.error.log.

Apache's docs say that this is:

where Apache httpd will send diagnostic information and record any errors that it encounters

So I think it's not too crazy to include CKAN's INFO messages there alongside its WARNINGs (non-fatal errors) and ERRORs.

CKAN's default set-up is designed to be the simplest possible way, which is why the file handler was removed in this commit: https://github.com/ckan/ckan/commit/6e1d325d61e

But of course it's a compromise and all suggestions are welcome.

like image 62
D Read Avatar answered Oct 22 '22 23:10

D Read