Is there a lightweight logging framework/server I can use to setup remote logging in Java? I know log4j has SocketAppenders but a) I want a library that is more out of the box where I can simply run a log server, b) I want the logging calls to be completely asynchronous non-blocking from the rest of the code and c) A nice web based dashboard/viewer on the log-server would be also nice
Non-Blocking: It refers to the program that does not block the execution of further operations. Non-Blocking methods are executed asynchronously. Asynchronously means that the program may not necessarily execute line by line.
Java IO's various streams are blocking. It means when the thread invoke a write() or read(), then the thread is blocked until there is some data available for read, or the data is fully written. Non blocking I/O. Non blocking IO does not wait for the data to be read or write before returning.
Summary: Blocking is always synchronous. Synchronous call have blocking operations if it waits for some event to get complete, caller method may enter wait state. Synchronous call is non blocking, if it repeatedly check for some event to occur before proceeding for next instruction.
Non-blocking means that if an answer can't be returned rapidly, the API returns immediately with an error and does nothing else. So there must be some related way to query whether the API is ready to be called (that is, to simulate a wait in an efficient way, to avoid manual polling in a tight loop).
You could use log4j with a SyslogAppender
and use some tool for viewing the syslog(-ng).
Use the async appender wrapper that ships with log4j, a nice article about that can be found here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With