bb_log is a logger for Java which only requires one small JAR in your classpath provides superior performance and is still as simple to use as other loggers while providing the most used features (even message variables):

  • 7 predefined log levels FATAL, ERROR, WARN, INFO, DEBUG, FINE, TRACE, plus user extensible log levels.
  • a simple XML configuration file for formatter, appender and logger.
  • convenient API to log
    • old style with composed log messages
      debug("hello this is message " + n);
    • parameter style
      debug("hello this is message {0}", n);
    • Java 8 style
      debug(() ->"hello this is message " + n);
  • superior performance
  • small memory footprint

Current version is 1.0.0



Source and Issue Tracker


Instead of download the jar you may also use this dependency:


and add this repository to obtain the required jar files:

bebbosoft repository


To configure bb_log a config file with name bblog.xml is required. Providing no config file results into this minimal configuration:

    <logger name="" level="DEBUG" />

This will result into logging to System.out.

Here is a more complex example to discuss the available features. It contains the default settings plus the settings to create a XML log file.

<log timeout="50">
    <formatter name="f1" class="" dateFormat="yyyy-MM-dd HH:mm:ss.SSS"
        format="%d %p [%t] %C - %m" escape="false" />
    <appender name="a1" formatter="f1" class=""
        append="false" bufferSize="8192" baseName="logs/a1" dateFormat="_yyyyMMdd" />
    <formatter name="xml" class="" dateFormat="yyyy-MM-dd HH:mm:ss.SSS"
        format='&lt;%p time="%d" thread="%t" logger="%C"&gt;%m&lt;/%p&gt;' escape="true" />
    <appender name="x1" formatter="xml" class=""
        append="false" bufferSize="8192" baseName="logs/x1" dateFormat="_yyyyMMdd" />
    <logger name="" level="ERROR" appender="x1,a1" />
  • log
    • timeout: a numeric value to defer flushing.
      Omitting this value defaults to timeout=”0″ and this flushing after every log line
  • formatter
    • name: a name to refer to this format.
    • class: a class name for the formatter.
      Omitting this value defaults to class=””
    • dateFormat: a pattern for the date format used in the log file.
      Omitting this value defaults to dateFormat=”yyyy-MM-dd HH:mm:ss.SSS”
    • format: the format for the log line.
      Omitting this value defaults to format=”%d %p [%t] %C – %m”
    • escape: used to escape XML characters.
      Omitting this value defaults to escape=”false”
  • appender
    • name: a name to refer to this appender
    • formatter: the name of the refernced
      Omitting this value will use the default formatter.
    • class: the class name for the appender.
      Omitting this value defaults to class=””
    • append: true appends to the log file, false will delete an old file of the used name.
      Defaults to true.
    • bufferSize: to buffer the log line(s). Together with timeout a reasonable buffer size will gain speed.
      Defaults to bufferSize=”8192″
    • baseName: the base name of the log file.
      Required. For invalid file name System.out is used.
    • dateFormat: the date format for the log file extension.
      Defaults to: dateFormat=”_yyyyMMdd”
  • logger
    • name: the name path for the logger. The empty name “” refers to the root logger.
    • level: defines the log level to log.
      Defaults to level=”DEBUG”
    • appender: a list of the use appenders.
      Required. (if omitted System.out is used)

Code Example

This example shows how to log using the different styles.

import org.junit.Test;

public class TestLog {
    final static Logger LOG = Logger.getLogger(TestLog.class);

    int x;

    public void notReallyATest() {
        String m = "This is a log entry";
        int n = 42;"Now: " + System.currentTimeMillis() + ". " + m + " " + n);"Now: {0}. {2} {1}", System.currentTimeMillis(), n, m); -> "Now: " + System.currentTimeMillis() + ". " + m + " " + n);
        try {
            x = x / x;
        } catch (Exception ex) {
            LOG.error("Now: " + System.currentTimeMillis() + ". " + m + " " + n, ex);
            LOG.error("Now: {0}. {2} {1}", System.currentTimeMillis(), n, m, ex);
            LOG.error(() -> "Now: " + System.currentTimeMillis() + ". " + m + " " + n, ex);        


Leave a Reply