Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audit Log Table Not Capturing Create ID's #1445

Closed
dartajax opened this issue Jun 8, 2016 · 5 comments · Fixed by #1454
Closed

Audit Log Table Not Capturing Create ID's #1445

dartajax opened this issue Jun 8, 2016 · 5 comments · Fixed by #1454
Assignees
Labels

Comments

@dartajax
Copy link
Member

dartajax commented Jun 8, 2016

When a Course or a Session or possibly anything is created, the audit_log.objectID field value is captured as 0.

We need to capture the actual ID of the object being created in order to perform research on who created the Course, Session, or other curricular object. Maybe there is an order of events issue which writes to the table before the newly created ID has been determined.

@stopfstedt
Copy link
Member

stopfstedt commented Jun 10, 2016

the audit logger hooks into Doctrine's event lifecycle with an onFlush listener.
at that point in the process, generated IDs for new entities cannot be captured and logged - nothing has been written to the database yet.
for capturing record creation, we'll need to hook in at a later point.

i'll attempt to leverage the postFlush event for this.

@stopfstedt stopfstedt self-assigned this Jun 10, 2016
@stopfstedt stopfstedt added the BUG label Jun 10, 2016
@stopfstedt
Copy link
Member

hooking in via postFlush won't work, unfortunately.

see this proposed solution http://stackoverflow.com/a/11054101, it seems somewhat finicky but maybe worth a try.

@stopfstedt stopfstedt removed their assignment Jun 10, 2016
@stopfstedt
Copy link
Member

stopfstedt commented Jun 10, 2016

^ this won't work either, at least not in the context of record insertions issued via CLI commands, since HTTP kernel events are not triggered from the command line.

i'm afraid there is no satisfying solution ATM, at least I cannot see one.

@jrjohnson
Copy link
Member

Looks like there are a couple of PRs in doctrine that might help with this, but there are like 200+ PRs in doctrine un-merged. So I'm guessing that we're not going to get this any time soon. I wonder if we could try the separate queue/listener approach in the SO entry and try and find an appropriate event that gets called form the console or else use two separate events to flush our log queue.

@stopfstedt
Copy link
Member

just took another look at console commands and event hooks there.
perhaps the queue-based solution from SO posted above can be expanded to CLI-land via an even listener that hooks in at console.terminate.

http://symfony.com/doc/current/cookbook/console/logging.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants