Build Status


Logging library with support for multiple appenders, configurable formatting and log tracing.

Quick Guide

  1. Add the folowing to your pubspec.yaml and run pub install
	  log4dart: any
  1. Add log4dart to some code and run it
	import "package:log4dart/log4dart.dart";
	main() {
		var myClass = new MyClass();
	class MyClass {
		static final _logger = LoggerFactory.getLoggerFor(MyClass);
		someMethod() {"a info message");
			// :
			_logger.warnFormat("%s %s", ["message", "formatting"]);

Log4Dart is split in multiple libraries so it can run on both servers and in browsers.

// for client side logging (works both on the VM and when compiled to JS)
import "package:log4dart/log4dart.dart";

// for VM logging, allows you to log to files (does not compile to JS) 
import "package:log4dart/log4dart_vm.dart";

When you want to retrieve a logger instance you can do it in one of two ways

  1. LoggerFactory.getLoggerFor(MyClass) - create logger with the fully qualified name of MyClass
  2. LoggerFactory.getLogger("MyClass") - create logger with the name "MyClass"

Where the qualified name is the library name and type name concatenated together.

More Information

For information on how to configure Log4Dart, including log levels and output formatting, see the configuration guide. For infomation about Log4Dart's advanced features, such as log tracing, see here.



Logger that depends on VM functionality (file access).