Last active
August 29, 2015 14:16
-
-
Save getchenge/e89fe70f0142fe512c9f to your computer and use it in GitHub Desktop.
log4js & log4js syslog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var log4js = require('log4js'); | |
log4js.configure({ | |
appenders: [ | |
{ type: 'console' }, | |
{ type: 'file', filename: 'cheese.log', category: 'cheese' }, | |
{ | |
type: 'log4js-syslog-appender', | |
tag: 'My API', | |
facility: 'local0', | |
"path": "/dev/log", | |
"transport": "socket" | |
} | |
], | |
levels:{ | |
console:'ERROR', | |
cheese:'WARN', | |
syslog:'WARN' | |
}, | |
replaceConsole: true | |
}); | |
var logger = log4js.getLogger('syslog'); | |
var logger1 = log4js.getLogger('cheese'); | |
console.log('a console log'); | |
logger.trace('a trace message'); | |
logger.debug('a debug message'); | |
logger.info('an info message'); | |
logger.warn('a warning message'); | |
logger.error('an error message'); | |
logger.fatal('a fatal message'); | |
logger1.fatal('a fatal message'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment