# How to implement collaborative editing log recording

**URL:** <https://forum.collaboraonline.com/t/how-to-implement-collaborative-editing-log-recording/2985>\
**Category:** Development\
**Created:** [September 19, 2024, 1:41am UTC](https://forum.collaboraonline.com/t/how-to-implement-collaborative-editing-log-recording/2985 "2024-09-19T01:41:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gulixiang](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/gulixiang/32/1227_2.png) [@gulixiang](https://forum.collaboraonline.com/u/gulixiang)\
**Post date:** [September 19, 2024, 1:41am UTC](https://forum.collaboraonline.com/t/how-to-implement-collaborative-editing-log-recording/2985/1 "2024-09-19T01:41:47Z")

</div>

For instance, when multiple people are editing a document simultaneously, I want to keep track of who added or deleted what. Essentially, I’m aiming to track document changes. Would it be more feasible to achieve this by adding listeners in Python or by intercepting data with WebSockets on the frontend?

---

<div class="post-metadata">

**Author:** ![darshan](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/darshan/32/2230_2.png) [@darshan](https://forum.collaboraonline.com/u/darshan)\
**Post date:** [September 19, 2024, 9:47am UTC](https://forum.collaboraonline.com/t/how-to-implement-collaborative-editing-log-recording/2985/2 "2024-09-19T09:47:10Z")

</div>

### Which Approach is More Feasible?

- **Python Listeners (Backend)**: This is generally a safer and more stable approach if you have access to the Collabora Online backend or are comfortable working with PyUNO. It centralizes the change tracking and makes it easier to secure and store the logs. This approach is preferable in environments where you need control over the document lifecycle or want to ensure integrity.
- **WebSocket Interception (Frontend)**: This can be simpler to implement in environments where you don’t have backend access or if you want to quickly log changes made by multiple users in real time. However, security and performance concerns could arise in production settings.

Thanks,  
Darshan

---

<div class="post-metadata">

**Author:** ![gulixiang](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/gulixiang/32/1227_2.png) [@gulixiang](https://forum.collaboraonline.com/u/gulixiang)\
**Post date:** [September 20, 2024, 5:27am UTC](https://forum.collaboraonline.com/t/how-to-implement-collaborative-editing-log-recording/2985/3 "2024-09-20T05:27:28Z")

</div>

@darshan Thank you for your response. We prefer to implement using Python listeners (backend). However, when adding events such as XEventListener, XPasteListener, XModifyListener to the document (XSCRIPTCONTEXT.getDocument()), the event parameters do not provide specific change details, such as the content of the document before and after the modification. Could you please tell us from which object we can read this change information?

---

<div class="post-metadata">

**Author:** ![vmiklos](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/vmiklos/32/787_2.png) [@vmiklos](https://forum.collaboraonline.com/u/vmiklos)\
**Post date:** [September 20, 2024, 6:26am UTC](https://forum.collaboraonline.com/t/how-to-implement-collaborative-editing-log-recording/2985/4 "2024-09-20T06:26:20Z")

</div>

Did you see the built-in track changes functionality? See [Track Changes](https://help.collaboraoffice.com/24.04/en-US/text/shared/01/02230000.html)

---

<div class="post-metadata">

**Author:** ![gulixiang](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/gulixiang/32/1227_2.png) [@gulixiang](https://forum.collaboraonline.com/u/gulixiang)\
**Post date:** [September 24, 2024, 7:03am UTC](https://forum.collaboraonline.com/t/how-to-implement-collaborative-editing-log-recording/2985/5 "2024-09-24T07:03:41Z")

</div>

@vmiklos Thank you for your reply. This is the user’s operation document. Do you have any development documents? Which class interfaces can read this information?

---

<div class="post-metadata">

**Author:** ![vmiklos](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/vmiklos/32/787_2.png) [@vmiklos](https://forum.collaboraonline.com/u/vmiklos)\
**Post date:** [September 25, 2024, 7:16am UTC](https://forum.collaboraonline.com/t/how-to-implement-collaborative-editing-log-recording/2985/6 "2024-09-25T07:16:27Z")

</div>

The ultimate source of information when it comes to reading info with the UNO API is the ODF export in many cases. 🙂

See the code around here:

> <https://github.com/libreoffice/core/blob/84299f3da389987b1dd5c354d67c6ee5217a474c/xmloff/source/text/XMLRedlineExport.cxx>

---

<div class="post-metadata">

**Author:** ![elowendf](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/elowendf/32/1371_2.png) [@elowendf](https://forum.collaboraonline.com/u/elowendf)\
**Post date:** [October 11, 2024, 12:00pm UTC](https://forum.collaboraonline.com/t/how-to-implement-collaborative-editing-log-recording/2985/7 "2024-10-11T12:00:05Z")

</div>

Hey @gulixiang Both approaches can work but it is depends on your needs

Python listeners are great for tracking changes after they happen, ideal for logging or backend processing.  
WebSockets on the frontend provide real-time tracking, allowing
