Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #21790

ultralog: new concept of logging API

Newsgroups comp.lang.java.programmer
Date 2013-01-26 22:05 -0800
Message-ID <0cfefb99-94f9-44e0-9b58-926818a9560d@googlegroups.com> (permalink)
Subject ultralog: new concept of logging API
From Mikhail Vladimirov <vladimirow@mail.ru>

Show all headers | View raw


Hello, Java developers community.

Let me present "ultralog" project (http://code.google.com/p/ultralog/) which main purpose is to demonstrate new concept of how logging APIs could be structured.

The idea is that each logger in the application has its own interface specific to the purpose of the logger.  This interface defines all messages that could be logged via this logger.  Here is an example of such interface:

    protected interface HelloLogger extends BasicLogger
    {
        @LogMessage (level = INFO, template = "Hello, ${1}!")
        void hello (String user);
    }

The logging framework generates implementations of such interfaces on the fly or at compile time by compiling message templates into Java bytecode.  Here is how this logger could be used:

HelloLogger logger = LoggerManager.createLogger (HelloLogger.class);

    if (logger.isInfoEnabled ())
        logger.hello (System.getProperty ("user.name"));

Advantages of this approach:
    - Clear syntax.
    - All log messages for the logger are defined in one place which makes it easier to review and restyle them in consistent manner.
    - Log messages are defined as methods, so IDEs "find references" feature could be used to fine all places where particular message is logged.
    - Values of arbitrary types including primitive types could be substituted into log message without allocating any temporary objects.

See project WiKi (http://code.google.com/p/ultralog/wiki/TableOfContents) for more information and feel free to provide feedback.

--
Mikhail Vladimirov <vladimirow@mail.ru>

Back to comp.lang.java.programmer | Previous | NextNext in thread | Find similar | Unroll thread


Thread

ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-26 22:05 -0800
  Re: ultralog: new concept of logging API markspace <markspace@nospam.nospam> - 2013-01-27 10:39 -0800
    Re: ultralog: new concept of logging API vladimirow@mail.ru - 2013-01-27 11:03 -0800
      Re: ultralog: new concept of logging API Joerg Meier <joergmmeier@arcor.de> - 2013-01-27 20:48 +0100
        Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-27 20:15 -0800
      Re: ultralog: new concept of logging API Leif Roar Moldskred <leifm@dimnakorr.com> - 2013-01-27 13:51 -0600
        Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-27 19:57 -0800
  Re: ultralog: new concept of logging API Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-01-28 05:23 -0400
    Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-28 01:32 -0800
      Re: ultralog: new concept of logging API Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-01-28 05:37 -0400
        Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-28 02:06 -0800
      Re: ultralog: new concept of logging API Lew <lewbloch@gmail.com> - 2013-01-28 13:49 -0800
        Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-29 06:04 -0800
          Re: ultralog: new concept of logging API Lew <lewbloch@gmail.com> - 2013-01-29 10:19 -0800
          Re: ultralog: new concept of logging API Leif Roar Moldskred <leifm@dimnakorr.com> - 2013-01-29 13:10 -0600
            Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-29 11:34 -0800
              Re: ultralog: new concept of logging API Arne Vajhøj <arne@vajhoej.dk> - 2013-01-29 20:16 -0500
                Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-29 19:57 -0800
                Re: ultralog: new concept of logging API Lew <lewbloch@gmail.com> - 2013-01-29 22:56 -0800
                Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-29 23:19 -0800
                Re: ultralog: new concept of logging API Lew <lewbloch@gmail.com> - 2013-01-30 08:23 -0800
                Re: ultralog: new concept of logging API lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-01-30 16:54 +0000
                Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-30 13:33 -0800
                Re: ultralog: new concept of logging API tisue@cs.nwu.edu (Seth Tisue) - 2013-01-30 16:37 -0500
                Re: ultralog: new concept of logging API tisue@cs.nwu.edu (Seth Tisue) - 2013-01-30 16:33 -0500
                Re: ultralog: new concept of logging API Arne Vajhøj <arne@vajhoej.dk> - 2013-01-30 21:50 -0500
                Re: ultralog: new concept of logging API lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-01-31 10:38 +0000
                Re: ultralog: new concept of logging API T®oll <spooksRus@derbyshire-crania.org> - 2013-01-31 12:30 -0500
                Re: ultralog: new concept of logging API T®oll <spooksRus@derbyshire-crania.org> - 2013-01-31 12:30 -0500
                Re: ultralog: new concept of logging API lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-01-31 17:55 +0000
                Re: ultralog: new concept of logging API lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-01-31 10:48 +0000
                Re: ultralog: new concept of logging API T®oll <spooksRus@derbyshire-crania.org> - 2013-01-31 12:32 -0500
                Re: ultralog: new concept of logging API lipska the kat <"nospam at neversurrender dot co dot uk"> - 2013-01-31 17:58 +0000
                Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-31 21:49 -0800
                Re: ultralog: new concept of logging API Arne Vajhøj <arne@vajhoej.dk> - 2013-01-30 21:47 -0500
                Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-30 21:14 -0800
                Re: ultralog: new concept of logging API Arne Vajhøj <arne@vajhoej.dk> - 2013-01-30 21:43 -0500
                Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-30 21:11 -0800
  Re: ultralog: new concept of logging API Mikhail Vladimirov <vladimirow@mail.ru> - 2013-01-30 13:43 -0800

csiph-web