logging the Scala way and named varargs

View: New views
4 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

Re: logging the Scala way and named varargs

by Raoul Duke :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> So I urge you to take time to write a better replacement, as something
> better would certainly revolutionize the field. And, trust me, people on
> operations need all the help they can get.

Agreed that there are many possible usage scenarios. My personal pain
point is mostly about trying to use a severity system for something
that should be more categorical, and having to resort to various
'hacks' like having multiple different logger objects to juggle and
stuff. I believe there is a better API somewhere Out There in the
Platonic World that could make my personal life less frustrating.
Dunno how much it would help others, but I mostly feel like it
couldn't be much worse than how things are now ;-)

sincerely.

Re: logging the Scala way and named varargs

by Daniel Sobral :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

FWIW, syslog uses a pair class, severity. You match on class individually (kernel, mail, etc), and on severity "up to the level".
 
On Java, you can specify class and method, though.

On Thu, Jun 18, 2009 at 4:00 PM, Ricky Clarkson <ricky.clarkson@...> wrote:
I sent a few months on the death march of a mobile phone WAP browser
integration a number of years ago, everything in C, with a logging
system that I liked and was disappointed to later discover was not
standard in the industry.

Instead of logging levels, we used categories, so that, say,
log(MEMORY, "malloc returned NULL"), log(SEAN, "Sean broke arrays"),
log(MOUSE, "It's a phone, it doesn't have a damn mouse.") were
written, and one could decide what to filter on.  So instead of
switching from viewing warnings to viewing info and seeing a lot of
unrelated noise, you could watch all memory problems by watching the
category MEMORY.

I have a vague idea that log4j or something actually supports this,
but I've never seen this pattern actually used since 2001.

2009/6/18 Raoul Duke <raould@...>:
>> I disagree. I think most folks who have been programming for awhile are quite
>> used to the fatal-error-warn-info-debug/trace paradigms.
>
> [i'm assuming that the f/e/w/i/d/t is an ordering, so that if you set
> the logging level to "debug" you will get all of f/e/w/i and d, but
> not t]
>
> i believe the usual approach to logging in the java world to be a
> clear indictment of the ability of java developers to actually think
> about semantics at all. it is such a horribly anemic and wrong-headed
> approach. and it continually blows my mind that the people using these
> systems don't seem to ever stop and realize how poor a fit the
> f/e/w/i/d/t type approach is to actually getting work done.
>
> no i haven't taken the time to write a better replacement. i already
> don't have any free time. :-P
>
> sincerely,
> the curmudgeon.
>



--
Ricky Clarkson
Java Programmer, AD Holdings
+44 1565 770804
Skype: ricky_clarkson
Google Talk: ricky.clarkson@...



--
Daniel C. Sobral

Something I learned in academia: there are three kinds of academic reviews: review by name, review by reference and review by value.

Re: logging the Scala way and named varargs

by Chris Twiner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Jun 18, 2009 at 10:47 PM, Raoul Duke<raould@...> wrote:

>> So I urge you to take time to write a better replacement, as something
>> better would certainly revolutionize the field. And, trust me, people on
>> operations need all the help they can get.
>
> Agreed that there are many possible usage scenarios. My personal pain
> point is mostly about trying to use a severity system for something
> that should be more categorical, and having to resort to various
> 'hacks' like having multiple different logger objects to juggle and
> stuff. I believe there is a better API somewhere Out There in the
> Platonic World that could make my personal life less frustrating.
> Dunno how much it would help others, but I mostly feel like it
> couldn't be much worse than how things are now ;-)
>
> sincerely.
>

I like the severity system but I'm also fond of logging you can subscribe to:

http://enthusiasm.cozy.org/archives/2009/02/listening-to-the-system

I think a simple hierarchy approach of categories (log4j) serves this
purpose, severity also allows a further dimension along this (which
you can choose to ignore).  A tibco esque subscription language on the
category (or indeed AMPQ) also matches quite nicely.

For my own pet project I'm planning to make a simple wrapper around
ampq for this purpose as well (via an embedded qpid instance)
alongside the traditional logging.  Perhaps even having log4j listen
into this... so many dreams so little time (and yes, probably little
need, but that's what pet projects are for ^_^ )

Re: logging the Scala way and named varargs

by Walter Smith :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Raoul,

Raoul Duke wrote:
My personal pain point is mostly about trying to use a severity system for something
that should be more categorical, and having to resort to various
'hacks' like having multiple different logger objects to juggle and stuff.
This is not a 'hack' at all! You'll always have to define your categories somewhere. You then can use them wherever you need them. You can even define subcategories like MEMORY.GARBAGECOLLECTOR if you sometimes need more fine grained control. The only thing that you could be missing is aliases, i.e. defining that one category is the same as another one (making the categories a directed graph). Maybe that's something you could improve upon (there are a number of challenges you'll have to address: How to handle recursive categories; what to do if the filter configuration is contradictory; probably more).

And SLF4J allows you to additionally pass Marker objects into your log statements that have a name and can reference other Markers. I haven't felt the need for these guys, but maybe it's what you're looking for.

Using the fully qualified class name is just a convention that has turned out to be generally a good idea, but it's by no means mandatory!

Kind regards
Walter
< Prev | 1 - 2 | Next >