Get started with log4javascript CDN

Apache-2.0 licensed

Log4JS is a popular open-source logging library for JS applications.

Tags:
  • log4javascript
  • log4j
  • logger

Stable version

Copied!

How to start using log4javascript CDN


// Include log4javascript library from CDN
const Log4j = require('log4js').default;
Log4j.loadConfig({ sync: true, config: { appenders: { consoleAppender: { type: 'console' } }, root: { level: 'debug', appenders: ['consoleAppender'] } } });

// Create a logger instance
const logger = Log4j.getLogger('MyLogger');

// Log messages with different levels
logger.debug('This is a debug message');
logger.info('This is an informational message');
logger.warn('This is a warning message');
logger.error('This is an error message');
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions