log4dart 1.4.19

  • README.md
  • Installing
  • Versions
  • 57

Build Status Coverage Status


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

Getting Started

1. Add the folowing to your pubspec.yaml and run pub install

	  log4dart: any

2. 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() {
			_logger.info("a info message");
			// :
			_logger.warnFormat("%s %s", ["message", "formatting"]);

Creating Loggers

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) - logger with the fully qualified name of MyClass
  2. LoggerFactory.getLogger("MyClass") - logger with the name "MyClass"

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

More Information

The configuration guide covers everything from log level setup to output formatting. For more advanced features, such as log tracing, check out the advanced feature guide.


  • Remove dependency on meta package


  • Correct copyright message


  • Bump dependencies


  • Rewrite tests to gain better code coverage


  • Further fixes to organize project to work with Travis CI


  • Switch to Travis CI


  • Switch to new Dart test library


  • Add changelog

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  log4dart: ^1.4.19

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:log4dart/log4dart.dart';
Version Uploaded Documentation Archive
1.4.19 Apr 19, 2016 Go to the documentation of log4dart 1.4.19 Download log4dart 1.4.19 archive
1.4.18 Feb 1, 2016 Go to the documentation of log4dart 1.4.18 Download log4dart 1.4.18 archive
1.4.17 Feb 1, 2016 Go to the documentation of log4dart 1.4.17 Download log4dart 1.4.17 archive
1.4.16 Aug 4, 2015 Go to the documentation of log4dart 1.4.16 Download log4dart 1.4.16 archive
1.4.15 Jun 30, 2015 Go to the documentation of log4dart 1.4.15 Download log4dart 1.4.15 archive
1.4.14 May 23, 2015 Go to the documentation of log4dart 1.4.14 Download log4dart 1.4.14 archive
1.4.13 Mar 13, 2015 Go to the documentation of log4dart 1.4.13 Download log4dart 1.4.13 archive
1.4.12 Nov 13, 2013 Go to the documentation of log4dart 1.4.12 Download log4dart 1.4.12 archive
1.4.11 Nov 3, 2013 Go to the documentation of log4dart 1.4.11 Download log4dart 1.4.11 archive
1.4.10 Oct 23, 2013 Go to the documentation of log4dart 1.4.10 Download log4dart 1.4.10 archive

All 33 versions...

Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jul 20, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.69.0
  • pana: 0.11.7


Detected platforms: web, other

Primary library: package:log4dart/log4dart.dart with components: mirrors.

Issues and suggestions

Fix lib/src/logger_config.dart.

Analysis of lib/src/logger_config.dart failed with 1 error:

line 64 col 3: Invalid override. The type of 'LoggerConfig.==' ('(LoggerConfig) → bool') isn't a subtype of 'Object.==' ('(dynamic) → bool').

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Package is too old.

The package was released more than two years ago.

Fix lib/src/appenders/file_appender.dart.

Analysis of lib/src/appenders/file_appender.dart reported 1 hint:

line 22 col 33: 'APPEND' is deprecated and shouldn't be used.

Maintain an example.

None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use log4dart.dart.

Fix additional 5 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/log_record.dart (Run dartfmt to format lib/src/log_record.dart.)
  • lib/src/log_record_formatter.dart (Run dartfmt to format lib/src/log_record_formatter.dart.)
  • lib/src/logger_config_map.dart (Run dartfmt to format lib/src/logger_config_map.dart.)
  • lib/src/logger_factory.dart (Run dartfmt to format lib/src/logger_factory.dart.)
  • lib/src/logger_impl.dart (Run dartfmt to format lib/src/logger_impl.dart.)


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.9.0 <2.0.0
sprintf ^1.0.8 1.0.8 3.0.2
Dev dependencies
test any