Using pub-sub architecture means that subscribers that come online later can bind to the exchange, a.k.a publisher, and get messages that it can use for its own purpose. This is the basis of the publish-subscribe pattern or pub-sub, for short. The benefit of using an exchange is that one or more subscribers can bind to it and receive a copy of any message sent. RabbitMQ, another popular messaging technology, uses the term exchange. The term used by Amazon Simple Notification Services for an exchange is a topic. Conceptually that endpoint is an exchange, a place where messages are collected and then distributed to interested parties. A Message Broker publishes an entry point, usually an HTTP URL that accepts messages as a POST request. In a message-based approach, the logger emits a log entry as a message to a single target, a Message Broker. In fact, the notion of “target” goes away altogether and is replaced by the concept of a subscriber.įigure 2 shows a simple message-based logging architecture using the pub-sub pattern. Adding targets after the logger is deployed is difficult.īy taking a message-based approach, you can avoid having to fidget with an application’s logger to add new targets. However, this scenario is limited in that the logger needs to know at the onset the various targets in play. In the case of using a target-based logger such as Log4J, the application sends the log entry to a logger and the logger has the wherewithal to format and send that log entry onto various targets. Taking a Message-Based Approach to LoggingĪs mentioned at the beginning of this article, a log entry is basically a message. Is there a way to avoid the problem? Yes, use a message-based approach to logging. You might have to take the entire application offline to deploy the new logging functionality. Imagine that you have to add an additional target to a logger, for example a target that sends the log entry onto a mobile phone using SMS.Īdding the new target means having to deploy the appender as well as update and redeploy the logger configuration file, at the very least. Loggers are a reliable, well-known way to do logging. How each target handles the log entry is its own concern. The important thing to understand in terms of application-based logging is that the application submits a log entry to a logger and then the logger forwards it onto one or more targets. The same is true of Winston, a popular logger for Node.JS. Log4J, the most popular logger for Java programming, allows you to configure multiple log appenders to the logger, with each appender dedicated to a particular target. The target can be a file, database, logging service, or depending on the logger technology, all of the above. Binding a logger to one or many targets is done via logger configuration. ![]() A logger is an object or component that sends log entry data to a target destination. ![]() Typically, logging is implemented in an application using a logger. Understanding a Standard Logging Architecture Messaging creates the loose coupling that allows a logging system to be adaptable to the needs at hand and extensible over time. ![]() As such, taking a message-based approach to logging by utilizing messaging technologies makes sense. When you think about it, a log entry is really nothing more than a message that describes an event.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |