Return-Path: Delivered-To: apmail-logging-log4j-dev-archive@www.apache.org Received: (qmail 41951 invoked from network); 13 Jan 2006 13:16:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 13 Jan 2006 13:16:50 -0000 Received: (qmail 90344 invoked by uid 500); 13 Jan 2006 13:16:39 -0000 Delivered-To: apmail-logging-log4j-dev-archive@logging.apache.org Received: (qmail 90314 invoked by uid 500); 13 Jan 2006 13:16:38 -0000 Mailing-List: contact log4j-dev-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Developers List" Reply-To: "Log4J Developers List" Delivered-To: mailing list log4j-dev@logging.apache.org Received: (qmail 90303 invoked by uid 99); 13 Jan 2006 13:16:38 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Jan 2006 05:16:38 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [212.33.142.3] (HELO challenger.coretrek.no) (212.33.142.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Jan 2006 05:16:36 -0800 Received: from enterprise.intra.coretrek.com (wormhole.coretrek.no [212.33.142.10]) by challenger.coretrek.no (Postfix) with ESMTP id D40E2F91F4 for ; Fri, 13 Jan 2006 14:16:12 +0100 (CET) Date: Fri, 13 Jan 2006 14:16:12 +0100 (CET) From: =?iso-8859-15?Q?Endre_St=F8lsvik?= X-X-Sender: endre@enterprise.intra.coretrek.com To: Log4J Developers List Subject: Re: Experimental log4j formatter in sandbox In-Reply-To: <361544A9-C4AD-4614-BB02-548BC6ECBFF9@apache.org> Message-ID: <20060113134909.U79615@enterprise.intra.coretrek.com> References: <361544A9-C4AD-4614-BB02-548BC6ECBFF9@apache.org> X-My-Opinion: War and bombs are bad. Peace and flowers are good. ;-D MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N | | One of my concerns was introducing yet another pattern syntax when Java class | libraries already have two (java.text.MessageFormat and java.util.Formatter). | I had originally thought that the substitution pattern format was a subset of | that supported by java.text.MessageFormat, same here.. | however java.text.MessageFormat | would require parameter numbers within the braces (for example, "The {0} | jumped over the moon {1} times"). .. The whole point of using explicit positions, is that in some languages, the order of the two elements would be changed. So if you want localized formatting/logging, the {} won't cut it. I just made a set of methods for text-formatting in our portal-framework. I think that MessageFormat is too complex, so I turned to log4j to look at the approach there, and possibly loan some code. However, that won't cut it either, since this approach doesn't take into account the fact about languages' differences in word ordering. I ended up making a system that combines the two: A "{}" chooses the /first available/ variable, while {x} explicitly specifies one. Thus, "{} {} {}" == "{0} {1} {2}" (most normal case), "{1} {} {}" == "{1} {0} {2}" (some language that requires that subject and object is changed?) and "{} {} {0}" == "ERROR". Regards, Endre. --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-dev-help@logging.apache.org