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

Log user actions #3685

Merged
merged 2 commits into from
Dec 19, 2017
Merged

Log user actions #3685

merged 2 commits into from
Dec 19, 2017

Conversation

Abyss777
Copy link
Collaborator

Here is implementation of logging user actions:

  • Object create/edit/remove
  • Objects link/unlink
  • User login/logout
  • Reset device total distance

Made it non-switchable, only with global log. I do not think log size will grow dramatically in comparing with device communications debug.

Example:

2017-12-13 14:48:21  INFO: User: 1, Action: login
2017-12-13 12:05:53  INFO: User: 1, Action: edit, Object: User, Id: 18
2017-12-13 12:06:27  INFO: User: 1, Action: link, Owner: User, Id: 18, Property: Group, Id: 11
2017-12-13 12:06:28  INFO: User: 1, Action: link, Owner: User, Id: 18, Property: Group, Id: 5
2017-12-13 12:06:30  INFO: User: 1, Action: unlink, Owner: User, Id: 18, Property: Group, Id: 11
2017-12-13 14:48:23  INFO: User: 1, Action: logout
2017-12-13 14:48:21  INFO: User: 2, Action: login
2017-12-13 12:07:29  INFO: User: 2, Action: create, Object: Device, Id: 52
2017-12-13 12:07:29  INFO: User: 2, Action: link, Owner: User, Id: 2, Property: Device, Id: 52
2017-12-13 12:16:13  INFO: User: 2, Action: remove, Object: Device, Id: 52
2017-12-13 14:48:21  INFO: User: 2, Action: login
2017-12-13 14:48:23  INFO: User: 2, Action: logout
2017-12-18 16:40:11  INFO: User: 1, Action: login
2017-12-18 16:40:34  INFO: User: 1, Action: resetTotalDistance, DeviceId: 8

fix #3528


private static final String ACTION_TOTAL_DISTANCE = "resetTotalDistance";

private static final String PATTERN_OBJECT = "User: %d, Action: %s, Object: %s, Id: %d";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to use low-case words everywhere. It will make it consistent with location info logging.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I also "toLowerCase" class names or it is OK?

2017-12-19 12:13:33  INFO: user: 1, action: login
2017-12-19 12:13:45  INFO: user: 1, action: edit, object: Device, id: 36
2017-12-19 12:13:59  INFO: user: 1, action: edit, object: Server, id: 1
2017-12-19 12:14:32  INFO: user: 1, action: link, owner: Device, id: 36, property: Geofence, id: 5

Copy link
Member

@tananaev tananaev Dec 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think classnames are fine. Or maybe we can make them lower-camel-case for consistency.

@Abyss777
Copy link
Collaborator Author

Done

2017-12-19 12:35:49  INFO: user: 1, action: edit, object: server, id: 1
2017-12-19 12:35:59  INFO: user: 1, action: edit, object: device, id: 7
2017-12-19 12:36:12  INFO: user: 1, action: link, owner: device, id: 7, property: geofence, id: 5
2017-12-19 12:36:14  INFO: user: 1, action: link, owner: device, id: 7, property: geofence, id: 6
2017-12-19 12:36:15  INFO: user: 1, action: unlink, owner: device, id: 7, property: geofence, id: 5

@tananaev tananaev merged commit f9b7863 into traccar:master Dec 19, 2017
@tananaev
Copy link
Member

Merged, thanks.

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

Successfully merging this pull request may close these issues.

Feature request: Administrative Events
2 participants