Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #21818
| From | Arved Sandstrom <asandstrom2@eastlink.ca> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: ultralog: new concept of logging API |
| References | <0cfefb99-94f9-44e0-9b58-926818a9560d@googlegroups.com> |
| Message-ID | <3srNs.105645$EO2.76867@newsfe04.iad> (permalink) |
| Organization | Public Usenet Newsgroup Access |
| Date | 2013-01-28 05:23 -0400 |
On 01/27/2013 02:05 AM, Mikhail Vladimirov wrote:
> 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>
>
I think you're thinking the right things, I'm just not sure you've got
much of a better solution. Yet.
Let me describe what I typically do, let's say with log4j:
1. Write a little helper or utility class (these days I just copy it
from an existing project) that wraps core log4j calls, basically to
format log messages according to project/app guidelines. MessageFormat
usually figures prominently.
2. As I work through and actually start to log it, messages start to
amass in one or more logging .properties files. The property key syntax
I use for logging is usually a dotted notation, to help search for
messages when there are already hundreds or more entries.
So just by doing what I already do I get absolutely everything you tout
as an advantage of your new logging system.
AHS
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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