You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Dave King <da...@prefersoft.com> on 2001/03/29 20:36:02 UTC

NDC change

Hi,

I'm not sure on the preferred method for sending proposed updates.  I'd like
to update the DiagnosticContext to support adding empty NDCs with out adding
a blank.  I sent an email to list covering what I was trying to do on March
26 so I wont repeat that here.

The change is in the DiadgnosticContetxt inner class.


   private static class DiagnosticContext {

    	String fullMessage;
    	String message;
    
	DiagnosticContext(String message, DiagnosticContext parent) {
      	this.message = message;
      	if(parent != null) {
				if(isBlank(message)){
					fullMessage = parent.fullMessage;
				} else {
					fullMessage = parent.fullMessage + '
' + message;
				}
      	} else {
				fullMessage = message;
      	}
    	}
		
	private boolean isBlank(String s){
		return s == null || s.length()==0;
	}
  }


The diff is:

376c376,380
< 	fullMessage = parent.fullMessage + ' ' + message;
---
> 				if(isBlank(message)){
> 					fullMessage = parent.fullMessage;
> 				} else {
> 					fullMessage = parent.fullMessage + '
' + message;
> 				}
380a385,388
> 		
> 		private boolean isBlank(String s){
> 			return s == null || s.length()==0;
> 		}


-Peace
Dave

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