Now we are implementing the logger on the client side. So storing the logs on the client side will be a huge blocker at this time.
Creating a log file in the server or storing the logs in the database will not be a possible solution for this scenario. because,
- We want to use another REST to create log file or store in the database. So what will be the solution if this REST call failed?
- We want to access the REST every time to store the logs. (Bulk transfer is not possible, because what can we do if there are any break points during that time duration?
- It may take some time to achieve this task using REST. So we can't call the REST every time to transfer the logs to the server.(huge delay)
So In my view, Using REST services again for the logging is not a good solution to achieve this task.
What is the Solution?
why we can't use browser session/cookie for this purpose? Because server side doesn't need this logs anymore. The developer or user who is working in the front end is only wanted this log by that time or after.
So I just think about this idea,
- Store the logs into session/cookie(single or multiple) if logging is enabled.
- Create one common page for logs accessing which can contain the capability to retrieve the logs from the browser session/cookie.
- Improve that page to view as a logger or create a log file automatically (we can simply create a text file with the logs using JS)
- The user can get the immediate logs in their console. if the user wants to get some previous logs, he can just visit that page to get that logs. (Anymore if the session/cookie is lost - there are no way )
I think It will be a simple and good way for the front-end developers and light weight implementation for the logger.
Note: We can create some algorithms to create multiple cookies for the logs. Because storing the huge logs into a single cookie is not possible. So we want to follow some multi cookie management here.
If you have any suggestions or idea, let's discuss to improve this talk