hep-gc / shoal

A squid cache publishing and advertising tool designed to work in fast changing environments
Apache License 2.0
4 stars 8 forks source link

logging for shoal client #134

Closed rptaylor closed 6 years ago

rptaylor commented 7 years ago

Shoal client has: logging.basicConfig(filename="/tmp/shoal_client.log", format='%(asctime)s %(message)s', level=logging.INFO)

Maybe this was just added for our own debugging purposes. It is important to have logging, but this requires that the log file be writeable by the user invoking shoal client. Since any user on the system should be able to use the client, this would require 0777 permission which is bad practice.

Best solution would be to use a python interface to syslog , then we don't need to worry about the log files or their permissions. This should be relatively straightforward? https://docs.python.org/2/library/syslog.html

The current version of shoal client does not work out of the box so this is a significant blocker.

Traceback (most recent call last):
  File "/usr/bin/shoal-client", line 30, in <module>
    logging.basicConfig(filename="/var/log/shoal_client.log", format='%(asctime)s %(message)s', level=logging.INFO)
  File "/usr/lib64/python2.7/logging/__init__.py", line 1529, in basicConfig
    hdlr = FileHandler(filename, mode)
  File "/usr/lib64/python2.7/logging/__init__.py", line 902, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib64/python2.7/logging/__init__.py", line 925, in _open
    stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: '/var/log/shoal_client.log'