[logback-dev] [JIRA] Updated: (LBGENERAL-49) Logback does not pass turkey test

Sebastian Davids (JIRA) noreply-jira at qos.ch
Thu Dec 1 05:46:13 CET 2011


     [ http://jira.qos.ch/browse/LBGENERAL-49?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebastian Davids updated LBGENERAL-49:
--------------------------------------

    Attachment: turkey.patch

HTTP Header
http://www.w3.org/Protocols/HTTP/HTRQ_Headers.html
http://www.faqs.org/rfcs/rfc822.html

=> Locale.US should be fine

DB table names

http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements008.htm#sthref728
http://dev.mysql.com/doc/refman/5.1/en/identifiers.html
http://msdn.microsoft.com/en-us/library/ms175874.aspx

=> harder to decide but Locale.US should be fine also

@@

capitalizeFirstLetter handles cases where programmers write source code in their own language.

> Logback does not pass turkey test
> ---------------------------------
>
>                 Key: LBGENERAL-49
>                 URL: http://jira.qos.ch/browse/LBGENERAL-49
>             Project: logback-general
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>            Reporter: Sebastian Davids
>            Assignee: Logback dev list
>         Attachments: turkey.patch
>
>
> import java.io.Serializable;
> import java.util.ArrayList;
> import java.util.List;
> public class Bean implements Serializable {
> 	private static final long serialVersionUID = 1957667958813006175L;
> 	private List<String> iceCreams = new ArrayList<String>();
> 	public void addIceCream(String iceCream) {
> 		iceCreams.add(iceCream);
> 	}
> 	@Override
> 	public String toString() {
> 		return iceCreams.toString();
> 	}
> }
> ////
> import java.beans.Introspector;
> import java.util.Locale;
> import org.slf4j.LoggerFactory;
> import ch.qos.logback.classic.Level;
> import ch.qos.logback.classic.Logger;
> import ch.qos.logback.classic.html.HTMLLayout;
> import ch.qos.logback.classic.spi.ILoggingEvent;
> import ch.qos.logback.classic.spi.LoggingEvent;
> import ch.qos.logback.core.ContextBase;
> import ch.qos.logback.core.joran.util.PropertySetter;
> public class Main {
> 	public static void main(String[] args) {
> 		Bean bean = new Bean();
> 		PropertySetter setter = new PropertySetter(bean);
> 		setter.setContext(new ContextBase());
> 		String propertyName = "iceCream";
> 		setter.addBasicProperty(propertyName, "vanilla");
> 		System.out.println(bean);
> 		System.out.println(propertyName.toUpperCase());
> 		Locale.setDefault(new Locale("tr", "", ""));
> 		setter.addBasicProperty(propertyName, "chocolate");
> 		System.out.println(bean);
> 		System.out.println(propertyName.toUpperCase());
> 		System.out.println(Introspector.decapitalize("IceCream"));
> 		System.out.println("I".toLowerCase() + "ceCream");
> 		System.out.println(capitalizeFirstLetter(propertyName));
> 		System.out.println("i".toUpperCase() + "ceCream");
> 		Logger logger = (Logger) LoggerFactory.getLogger("iAmALogger");
> 		Level level = Level.INFO;
> 		ILoggingEvent event = new LoggingEvent("iAmALoggingEvent", logger, level, "i am logging", null, null);
> 		System.out.println(event);
> 		
> 		HTMLLayout layout = new HTMLLayout();
> 		String html = layout.doLayout(event);
> 		System.out.println(html);
> 	}
> 	public static String capitalizeFirstLetter(String name) {
> 		if (name == null || name.length() == 0) {
> 			return name;
> 		}
> 		char chars[] = name.toCharArray();
> 		chars[0] = Character.toUpperCase(chars[0]);
> 		return new String(chars);
> 	}
> }
> @@ Output @@
> [vanilla]
> ICECREAM
> [vanilla]
> İCECREAM
> iceCream
> ıceCream
> IceCream
> İceCream
> [INFO] i am logging
> <tr class="ınfo even">
> </tr>
> @@@@
> http://www.codinghorror.com/blog/2008/03/whats-wrong-with-turkey.html

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       


More information about the logback-dev mailing list