attributes and element names are case insensitive. Ralph
On May 8, 2013, at 12:31 PM, Nick Williams wrote: > Is this a matter of examples, or are the elements actually case sensitive > (i.e., will BOTH <console></console> AND <Console></Console> work)? > > If it's a matter of examples, then lets make all of the elements consistent > in examples. > > If the elements are actually case sensitive and <console></console> won't > work, my arguments are (in order of importance): > > 1) No matter what, be consistent. All element names should use the same > casing as all other element names, all attribute names should use the same > casing as other attribute names. > > 2) The Log4j 2 configuration was designed to be rather forgiving (e.g., > attributes can be specified as sub-elements instead). I think all matches > should be performed case-insensitively, just like HTML, if we want to further > the goal of forgiveness. There's no reason for two appenders to have the same > name with a different case, for example, so there's no risk of collision. > > 3) My preference is for element names to always be a single word that's all > lower case, and for attribute names to be camelCase. > > Nick > > On May 8, 2013, at 2:20 PM, Gary Gregory wrote: > >> Our XML looks messy ATM because we mix two styles of XML element names: >> ElementName and elementName. For example appenders and Console. I propose we >> use ElementName throughout. Attribute usage is consistent with attributeName. >> >> Current messy example from >> https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk/core/src/test/resources/log4j-filetest.xml >> >> <configuration status="debug" dest="target/status.log" name="XMLConfigTest" >> packages="org.apache.logging.log4j.test"> >> <properties> >> <property name="filename">target/test.log</property> >> </properties> >> <ThresholdFilter level="debug"/> >> >> <appenders> >> <Console name="STDOUT"> >> <PatternLayout pattern="%m%n"/> >> </Console> >> <File name="File" fileName="${filename}" bufferedIO="false"> >> <PatternLayout> >> <pattern>%d %p %C{1.} [%t] %m%n</pattern> >> </PatternLayout> >> </File> >> <List name="List"> >> <filters> >> <ThresholdFilter level="error"/> >> </filters> >> </List> >> </appenders> >> >> <loggers> >> <logger name="org.apache.logging.log4j.test1" level="debug" >> additivity="false"> >> <ThreadContextMapFilter> >> <KeyValuePair key="test" value="123"/> >> </ThreadContextMapFilter> >> <appender-ref ref="STDOUT"/> >> </logger>> >> >> <logger name="org.apache.logging.log4j.test2" level="debug" >> additivity="false"> >> <appender-ref ref="File"/> >> </logger>> >> >> <root level="error"> >> <appender-ref ref="STDOUT"/> >> </root> >> </loggers> >> >> </configuration> >> >> Thoughts? >> >> Gary >> -- >> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org >> Java Persistence with Hibernate, Second Edition >> JUnit in Action, Second Edition >> Spring Batch in Action >> Blog: http://garygregory.wordpress.com >> Home: http://garygregory.com/ >> Tweet! http://twitter.com/GaryGregory >