DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43403>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43403





------- Additional Comments From [EMAIL PROTECTED]  2007-09-16 11:34 -------
I think the use case is reasonable, but I don't think the proposed solution is 
desirable.  First, the 
proposed solution isn't general enough. if there is a "prefix" why shouldn't 
there be a "suffix" too.  If it 
is desirable for NDC and MDC, why not for other fields as well. Second, 
implementing the solution 
would require hacking the pattern parser to support a new language feature.

ExtendedPatternLayout (the log4j 1.3 pattern layout backported for use with 
log4j 1.2 and provided in 
the extras companion) does support just %X which will print out all MDC values 
as key=value.

XSLTLayout (also in the extras) companion should also be capable of achieving 
your desired layout 
goals.  I haven't benchmarked XSLTLayout, but I would assume that it would have 
to be substantially 
slower than PatternLayout for equivalent tasks.  But it is hugely flexible and 
the performance different 
may not be an issue in your application.

If that isn't desirable, then possibly adding a new "replace" pattern to 
ExtendedPatternLayout in apache-
log4j-extras would be a reasonable approach that would not require hacking the 
pattern parser, just 
adding a new pattern specifier.  replace could look like:

%replace{layout pattern}{regex}{replacement}

So your NDC prefix would look like:

%c%replace{%x}{(.+)}{-$1}



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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

Reply via email to