bb_log a tiny and fast logger for Java

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).

WHY ANOTHER LOGGER

When I considered to build a new Major Version of my BEJY Server, I wanted to use some state of the art logging. So I had a look to log4j plus SLF4J. Both are well known.

Then I detected that there is a new Version coming: log4j2 which will provide Major speedups.
So [log4j|http://logging.apache.org/log4j/1.2/] is slow?
(Yes it is.)
And [log4j2 | http://logging.apache.org/log4j/2.x/] is faster?
(Yes it is)
But the size of the log4j2 jars is ridiculous huge. Way bigger than my Server implementation with all protocols together.
I only want a simple convenient logging library.
Well, I sat down and after view hours the first implementation was done:
AttributeComment
config file support only one variant in XML, similar to established XML config files
hierarchical Loggers yes, but only the first configured is used.
appenders stdout and file appenders right now
formatters reusable log line formatters
message variable Expansion yes, numbered {0}, {1} ... will be replaced with the corresponding Argument.
log line configurable yes
performance in my test even twice as fast than log4j2 with asynchronous IO.
reloadable config yes, not automatically, but without losing log lines.
tiny slightly above 50k for de.bb.product.bb_log-0.0.1.jar is ok. If the other de.bb libraries are used too, you can use de.bb.log-0.0.1.jar which is around 40k including sources, README, COPYING ...

USAGE


  1. add the standalone bb_log jar file to your class path.
  2. add a XML file bblog.xml to you class path
    <log>
    	<formatter name="F1" logFormat="%d %p [%t] %C - %m"/>
    	<appender name="A1" type="file" file="mylogfile" formatter="F1" />
    	<logger path="de.bb" appender="A1" level="DeBuG"/>
    </log>
    
  3. create Loggers where you need them:
      private final static Logger LOG = Logger.getLogger(MyClass.class);
    
  4. use the Loggers to log:
      LOG.debug("Argument 0: {0} invalid: {{ out of range: {99} Argument 1: {1}  again Argument 0: {0}", "dat is arg 0", "dis is arg 1", new Exception("foo"));
    
    datecomment
    2013-12-09initial release bb_log Version 0.0.1
    2013-12-09Initial release de.bb.log-0.0.1-SNAPSHOT.jar (Needs de.bb.io and de.bb.util, but includes sources).

    HINTS

  5. Here you find the apidoc.
  6. add Exceptions as last Argument in logging calls, to get the stacktrace into your log.

LICENSE

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <a href="http://www.gnu.org/licenses/" target="_blank">http://www.gnu.org/licenses/</a>.

rev: 1.5