You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Lethin, Doug" <Do...@Intuit.com> on 2004/03/15 13:58:14 UTC

whats the latest on domains?

Amidst all this this discussion on trace or no trace, I'd like to bring up
the topic of domains, which some have said will make the need for trace
uneccessary.

1. Whats the latest detail available for public consumption on domains?
Sometime back in Novemver or December, we got a small peek at domains
through one or two slides from ApacheCon.  Its been a while since I've seen
those slides and can't seem to find them to refresh my memory.

2. Whats the relationship to domains and levels, and loggers again?

I'm working on a logging project right now that seems to scream for what I
think  domains is trying to solve.

Right now, I'm using log4j in the recommended way, I think, and that is to
name my loggers based on the name of the class performing the logging, ie:

// psuedo-code here...
public class Dude
  private Logger log = Logger.getLogger(Dude.class);

This is well and good, but it limits my dimentionality.  For instance, I
need to have "loggers" based on purpose:

- a notification logger - for alerting operations
- an audit logger - send transaction result to a db
- a general application logger - for offline root cause analysis, etc.

3.Is this the thing domains are trying to solve?

4. Whats the next milestone for the domain feature?

Thanks in advance.

doug


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: whats the latest on domains?

Posted by Paul Smith <pa...@lawlex.com.au>.
On Mon, 2004-03-15 at 23:58, Lethin, Doug wrote:
> 1. Whats the latest detail available for public consumption on domains?
> Sometime back in Novemver or December, we got a small peek at domains
> through one or two slides from ApacheCon.  Its been a while since I've seen
> those slides and can't seem to find them to refresh my memory.
> 

Volunteer work runs in bursts based on availability of time, and right
now the whole dev team seems to be pretty much maxed-out,
work/life-wise.  It'll come, don't worry.

> 2. Whats the relationship to domains and levels, and loggers again?
> 

I'll leave Ceki to articulate that one more fully, I would not like to
do an injustice to trying to cover the important bits.


> Right now, I'm using log4j in the recommended way, I think, and that is to
> name my loggers based on the name of the class performing the logging, ie:
> 
> // psuedo-code here...
> public class Dude
>   private Logger log = Logger.getLogger(Dude.class);
> 
> This is well and good, but it limits my dimentionality.  For instance, I
> need to have "loggers" based on purpose:
> 
> - a notification logger - for alerting operations
> - an audit logger - send transaction result to a db
> - a general application logger - for offline root cause analysis, etc.
> 

Use separate Loggers for this:

* keep your class lever logger as you have above
* Define some constants that define the FQN of your
Notification/Audit/General loggers, and then declare them inside _each_
class that you want to use them in.

public class Dude
   private Logger LOG = Logger.getLogger(Dude.class);
   private Logger AUDIT_LOG =
Logger.getLogger(MyConstants.AUDIT_LOGGER_FQN);
   private Logger  GENERAL_LOG =
Logger.getLogger(MyConstants.GENERAL_LOGGER_FQN);


IMHO, this is preferable to having a Singleton for the non-class
specific loggers (if a little more tedious, but IDE's with some form of
template support help out here a lot).  My rationale for that is:

* You're dealing with 1 class (Logger), so there's consistency and
readability in the code, and no need to wonder what else might be in the
Singleton.

* You are able to use the .isDebugEnabled() style methods to eliminate
the cost of the log invocation.  You could have the Singleton expose
these methods as a delegate to Logger, but aren't you then duplicating
most of what the Logger class does?

I also think this pattern might/should/hope to be easily converted to a
domain concept later on, but to be honest I am not sure.

> 3.Is this the thing domains are trying to solve?
> 
> 4. Whats the next milestone for the domain feature?

paul.delegateTo(Ceki.getInstance());

cheers,

Paul Smith


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org