Logging Error after update to 3.5

first of all: thanks for the update and your hard work!!

Today I updated my testsystem to PI 3.5. Now I get the “error 500” on every request. The problem is somewhere in the logging.yml, which worked in 3.4.1. If I disable the container-audit, its ok again.
The error is:

File “/opt/privacyidea/lib/python3.6/site-packages/privacyidea/lib/audit.py”, line 77, in getAudit
audit = get_module_class(audit_module, “Audit”, “log”)(config, startdate)
TypeError: init() takes from 1 to 2 positional arguments but 3 were given

Here’s my logging.yml

version: 1
    class: logging.handlers.RotatingFileHandler
    backupCount: 5
    maxBytes: 1000000
    level: INFO
    filename: /var/log/privacyidea/privacyidea-audit.log
    - file
    level: INFO

Without the formatter it produced parseable JSON-output.

I hope, somebody could help me.

I wonder why we did not have a decent test case for this.

It looks like in the file lib/auditmodules/containeraudit.py line 49 has a bug:

I think it has to read:

 def __init__(self, config=None, startdate=None):

Hi Cornelius,

you are right, thats the trick!

Thank you!!

1 Like

Thank you for confirming this. Then we can fix it in the next patch release.

Hi Cornelius,
What I saw is if you do an Ubuntu upgrade, there is another error:
[privacyidea.lib.auditmodules.sqlaudit:306] exception OperationalError(’(pymysql.err.OperationalError) (1054, “Unknown column ‘startdate’ in ‘field list’”)’,)
Still error 500.
You can avoid this doing a manual upgrade.

Then for some reason the postinst script of you Ubuntu pdate did not work correctly.
The database schema was not updated correctly. (Which would happen during a successful Ubuntu update).