Veerappan Saravanan wrote:
> 
> Category has a method called l7dlog to help with parameterization and
> localization. But it doesn't quite do what I would like it to do.
> 
> If I have a resource bundle that has the following entry
> 
> ERROR_101=some error in the system
> 
> then if I call
> 
> l7dlog(Priority.ERROR, ERROR_101, null);
> 
> the output would be
> 
> "some error in the system"
> 
> instead I would like it to print the error code along with the message,
> something like
> 
> "ERROR_101: some error in the system"
> 
> I know of two solutions to this...
> 1. change the resource bundle entry to
> ERROR_101=ERROR_101:some error in the system
> but, this is erorr prone, since developers could always enter the wrong id
> in the message.
> 
> 2. Hack the Category class' l7dlog method to do customize it.
> In this case, every upgrade to log4j, I need to change my Category class,
> which could be a pain.
> 
> Are there any other solutions to this?
> 
> Help appreciated.
> 
> Thanks
> Van
> 

Hi Van and list,

I need this, too. 

Ceki: is it possible, e.g., to outsource the message building part of
the l7dlog methods into a separate method? Something similar to

public String buildMessage () {
      String msg = getResourceBundleString(key);
      // if message corresponding to 'key' could not be found in the
      // resource bundle, then default to 'key'.
      if(msg == null) {
        msg = key;
      }

      return msg;
}

Users are then able to override and perform some more exotic string
handling.

Regards
Claus

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to