I have Java servlet-based web applications. I would like to implement some operations in asynchronous manner, like for example writing to a log.
I would like to avoid JMS overhead and do something simple.
Managing threads myself doesn’t seem such a good idea in a server environment, you would probably need to tap into server thread pool etc. What is the best alternative for simple asynchronous operation?
Edit:
Just for clarification, since many suggested using log4j or other logging library, writing to a log operation is here more of an example. I am interested how to perform asynchronously any operation that need not be performed sequentially. Idea is to reply to user immediately and to continue processing costly operation in another thread.
In regards to log issue, we have an audit log we implemented to write a lot of data to a database and is used by the user during audit operations and at Help Desk. Writing a lot of information to DB can be very costly. We do use log4j for system log and since the appender is file appender we have no performance issues with our system log.