Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Logging + User Experience

 
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Any advice would be cool,

I am integrating logging into a web application,

The web application sends requests to a web service and then sends a log message to another web service,

But I want to send the log message to the logging web service without any affect to user experience,

So any advice to implement a buffer to group a number of logs together and then to flush the log messages to the web service after the log messages have reached a 100 log messages for example,

Cheers
 
Sheriff
Posts: 24658
58
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you explain what problem you are trying to solve here? "User experience" is a bit vague, specific questions are more practical.
 
Niall Loughnane
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for your reply,

currently my application:
* has an instance of Log4J for writing log messages to a log file,
* the writing to the log file is quick because the logging file is on the same server

new implemenation:
* im going to change the logging merchanism to be sending HTTP requests to a server rather than writing to a log file
* if there is an issue with the server - then the sending of the HTTP request could take a long time and block the feedback to the user and will affect the user experience of the web application

so i'm thinking of batching the logs in groups of 100 and then sending the batch to the HTTP server without any affect to the user flow through the application

items that i'm looking at are:
* Spring Batch
* colllect the log messages in a java.util.ArrayList and then send the log content in a new Spring Task Executor in an aysnchronous mode

any ideas?

Cheers
 
Paul Clapham
Sheriff
Posts: 24658
58
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Other option: continue to use log4j. It can do asynchronous logging as written, and it can log to sockets as written. You could write your own HTTP appender if necessary.
 
Been there. Done that. Went back for more. But this time, I took this tiny ad with me:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!