8000 mentioned changes in 1.0 · ThinkLib/log4js-node@bfdc796 · GitHub
[go: up one dir, main page]

Skip to content

Commit bfdc796

Browse files
author
Gareth Jones
committed
mentioned changes in 1.0
1 parent dc831b8 commit bfdc796

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
# log4js-node [![Build Status](https://secure.travis-ci.org/nomiddlename/log4js-node.png?branch=master)](http://travis-ci.org/nomiddlename/log4js-node)
22

33
[![NPM](https://nodei.co/npm/log4js.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/log4js/)
4-
4+
55
This is a conversion of the [log4js](https://github.com/stritti/log4js)
6-
framework to work with [node](http://nodejs.org). I've mainly stripped out the browser-specific code and tidied up some of the javascript.
6+
framework to work with [node](http://nodejs.org). I've mainly stripped out the browser-specific code and tidied up some of the javascript.
77

88
Out of the box it supports the following features:
99

1010
* coloured console logging to stdout or stderr
1111
* replacement of node's console.log functions (optional)
12-
* file appender, with log rolling based on file size
12+
* file appender, with configurable log rolling based on file size or date
1313
* SMTP appender
1414
* GELF appender
15-
* hook.io appender
1615
* Loggly appender
1716
* Logstash UDP appender
1817
* logFaces appender
@@ -21,6 +20,12 @@ Out of the box it supports the following features:
2120
* configurable log message layout/patterns
2221
* different log levels for different log categories (make some parts of your app log as DEBUG, others only ERRORS, etc.)
2322

23+
## Important changes in 1.0
24+
25+
The default appender has been changed from `console` to `stdout` - this alleviates a memory problem that happens when logging using console. If you're using log4js in a browser (via browserify), then you'll probably need to explicitly configure log4js to use the console appender now (unless browserify handles process.stdout).
26+
27+
I'm also trying to move away from `vows` for the tests, and use `tape` instead. New tests should be added to `test/tape`, not the vows ones.
28+
2429
NOTE: from log4js 0.5 onwards you'll need to explicitly enable replacement of node's console.log functions. Do this either by calling `log4js.replaceConsole()` or configuring with an object or json file like this:
2530

2631
```javascript
@@ -51,7 +56,7 @@ By default, log4js outputs to stdout with the coloured layout (thanks to [masylu
5156
```
5257
See example.js for a full example, but here's a snippet (also in fromreadme.js):
5358
```javascript
54-
var log4js = require('log4js');
59+
var log4js = require('log4js');
5560
//console log is loaded by default, so you won't normally need to do this
5661
//log4js.loadAppender('console');
5762
log4js.loadAppender('file');
@@ -87,9 +92,9 @@ log4js.configure({
8792
## configuration
8893

8994
You can configure the appenders and log levels manually (as above), or provide a
90-
configuration file (`log4js.configure('path/to/file.json')`), or a configuration object. The
91-
configuration file location may also be specified via the environment variable
92-
LOG4JS_CONFIG (`export LOG4JS_CONFIG=path/to/file.json`).
95+
configuration file (`log4js.configure('path/to/file.json')`), or a configuration object. The
96+
configuration file location may also be specified via the environment variable
97+
LOG4JS_CONFIG (`export LOG4JS_CONFIG=path/to/file.json`).
9398
An example file can be found in `test/log4js.json`. An example config file with log rolling is in `test/with-log-rolling.json`.
9499
You can configure log4js to check for configuration file changes at regular intervals, and if changed, reload. This allows changes to logging levels to occur without restarting the application.
95100

0 commit comments

Comments
 (0)
0