Skip to content

Instantly share code, notes, and snippets.

@getchenge
Last active August 29, 2015 14:16
Show Gist options
  • Save getchenge/e89fe70f0142fe512c9f to your computer and use it in GitHub Desktop.
Save getchenge/e89fe70f0142fe512c9f to your computer and use it in GitHub Desktop.
log4js & log4js syslog
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