New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

log4js-faye-appender

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

log4js-faye-appender

Custom appender for log4js based on a faye client

latest
Source
npmnpm
Version
0.1.2
Version published
Weekly downloads
3
-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

log4js-faye-appender

log4js-faye-appender is a custom appender for log4js capable of publishing log to a faye server

Install

npm install log4js-faye-appender

Usage

Simply configure the appender with url and channel parameters:

log4js.configure({
    appenders: [
        {type: 'log4js-faye-appender', url: 'http://localhost:8000', channel: '/faye'},
        {type: 'console'}
    ]
});

When log4js fails to find a given appender in its own library, it attempts to find it in node_modules, which is why you do not need to explicitly require anything other than log4js. This implies that, in order to work properly, log4js-faye-appender itself must reside inside a node_modules directory.

Examples

The examples folder contains 4 elements:

  • fayeServer which is a textbook faye server sample (in our case, the log aggregator)
  • logger which is a sample code showing how to use log4js-faye-appender
  • subscriber which is a simple node client to take a look at what the server pushes to its subscribers
  • www a simple web log viewer

Note that while log4js-faye-appender as a module does not depend directly on log4js, logger.js does depend on log4js and so you must install it for it to run:

npm install log4js

Now, the simplest way to test this is to have 2 terminals and one browser:

  • run node fayeServer.js
  • open www/index.html inside your favorite browser
  • run node logger.js

Credits

A previous effort of realizing a faye custom appender was carried out by Jim Alateras

License

MIT

Copyright (c) 2014 bitcraft Co. Ltd.

Keywords

log4js

FAQs

Package last updated on 18 Aug 2017

Related posts