<style>
/* Changing the layout to use less space for mobiles */
@media screen and (max-device-width: 480px), screen and (-webkit-min-device-pixel-ratio: 2) {
#email-body { min-width: 30em !important; }
#email-page { padding: 8px !important; }
#email-banner { padding: 8px 8px 0 8px !important; }
#email-avatar { margin: 1px 8px 8px 0 !important; padding: 0 !important; }
#email-fields { padding: 0 8px 8px 8px !important; }
#email-gutter { width: 0 !important; }
}
</style>
<div id="email-body">
<table id="email-wrap" align="center" border="0" cellpadding="0" cellspacing="0" style="background-color:#f0f0f0;color:#000000;width:100%;">
<tr valign="top">
<td id="email-page" style="padding:16px !important;">
<table align="center" border="0" cellpadding="0" cellspacing="0" style="background-color:#ffffff;border:1px solid #bbbbbb;color:#000000;width:100%;">
<tr valign="top">
<td bgcolor="#003366" style="background-color:#003366;color:#ffffff;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;line-height:1;"><img src="http://jira.qos.ch/s/en_USb9v8he-418945332/850/25/_/jira-logo-scaled.png" alt="" style="vertical-align:top;" /></td>
</tr><tr valign="top">
<td id="email-banner" style="padding:32px 32px 0 32px;">
<table align="left" border="0" cellpadding="0" cellspacing="0" width="100%" style="width:100%;">
<tr valign="top">
<td style="color:#505050;font-family:Arial,FreeSans,Helvetica,sans-serif;padding:0;">
<img id="email-avatar" src="http://jira.qos.ch/secure/useravatar?avatarId=10122" alt="" height="48" width="48" border="0" align="left" style="padding:0;margin: 0 16px 16px 0;" />
<div id="email-action" style="padding: 0 0 8px 0;font-size:12px;line-height:18px;">
<a class="user-hover" rel="spalme" id="email_spalme" href="http://jira.qos.ch/secure/ViewProfile.jspa?name=spalme" style="color:#326ca6;">Stefan Palme</a>
created <img src="http://jira.qos.ch/images/icons/issuetypes/improvement.png" height="16" width="16" border="0" align="absmiddle" alt="Improvement"> <a style='color:#326ca6;text-decoration:none;' href='http://jira.qos.ch/browse/LOGBACK-934'>LOGBACK-934</a>
</div>
<div id="email-summary" style="font-size:16px;line-height:20px;padding:2px 0 16px 0;">
<a style='color:#326ca6;text-decoration:none;' href='http://jira.qos.ch/browse/LOGBACK-934'><strong>Fix inconsistencies in XML synaxt for logback.xml</strong></a>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr valign="top">
<td id="email-fields" style="padding:0 32px 32px 32px;">
<table border="0" cellpadding="0" cellspacing="0" style="padding:0;text-align:left;width:100%;" width="100%">
<tr valign="top">
<td id="email-gutter" style="width:64px;white-space:nowrap;"></td>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr valign="top">
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
<strong style="font-weight:normal;color:#505050;">Issue Type:</strong>
</td>
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
<img src="http://jira.qos.ch/images/icons/issuetypes/improvement.png" height="16" width="16" border="0" align="absmiddle" alt="Improvement"> Improvement
</td>
</tr> <tr valign="top">
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
<strong style="font-weight:normal;color:#505050;">Affects Versions:</strong>
</td>
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
1.0.13 </td>
</tr>
<tr valign="top">
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
<strong style="font-weight:normal;color:#505050;">Assignee:</strong>
</td>
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
<a class="user-hover" rel="logback-dev@qos.ch" id="email_logback-dev@qos.ch" href="http://jira.qos.ch/secure/ViewProfile.jspa?name=logback-dev%40qos.ch" style="color:#326ca6;">Logback dev list</a>
</td>
</tr> <tr valign="top">
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
<strong style="font-weight:normal;color:#505050;">Components:</strong>
</td>
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
logback-core </td>
</tr>
<tr valign="top">
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
<strong style="font-weight:normal;color:#505050;">Created:</strong>
</td>
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
05/Jan/14 10:33 AM
</td>
</tr> <tr valign="top">
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
<strong style="font-weight:normal;color:#505050;">Description:</strong>
</td>
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
<p style='margin-top:0;margin-bottom:10px;'>For my local work I have created a namespace aware XSD schema describing almost the full syntax of logback.xml configuration files (to be able to use my IDE's auto-completion and validation features when editing logback.xml configuration files). </p>
<p style='margin-top:0;margin-bottom:10px;'>My XSD schema does explicitly NOT include all the bean properties for already existing Appender, Encoder, ... implementations, because this would be inconsistent as soon as I add my own Appender and Encoder implementations with totally different properties.</p>
<p style='margin-top:0;margin-bottom:10px;'>However, while writing the XSD I've found a subtle problem:</p>
<p style='margin-top:0;margin-bottom:10px;'>Some XML elements (appender, encoder, layout, ...) take a "class" attribute to specify the implementing class, and additional XML child elements to specify the values for the JavaBeans properties which are valid for these impl classes.</p>
<p style='margin-top:0;margin-bottom:10px;'>This approach is not bad at all, but at least for the "appender" element your current syntax description raises a problem. Take the following scenario:</p>
<p style='margin-top:0;margin-bottom:10px;'>public class ClusteredAppender implements Appender {<br/>
private String layout; // can be "LOADBALANCED or "ROUNDROBIN"<br/>
public void setLayout(String layout) </p>
{ ... };<br/>
public String getLayout() { ... }
<p style='margin-top:0;margin-bottom:10px;'>;<br/>
...<br/>
}</p>
<p style='margin-top:0;margin-bottom:10px;'><appender name="my" class="ClusteredAppender"><br/>
<layout>ROUNDROBIN</layout><br/>
</appender></p>
<p style='margin-top:0;margin-bottom:10px;'>According to your description of the XML syntax, an XML parser has no chance to know if this layout XML element is meant to be "your" layout element (refering to a layout implementation class), or if it means to be a bean property of my own ClusteredAppender implementation.</p>
<p style='margin-top:0;margin-bottom:10px;'>With the currently provided standard implementations for layouts, encoders, appenders etc. this problem does not occur (because there are no problematic bean property names), but what if I want to create my own implementations? I do not want to take care of bean property names that I must not use because of naming conflicts...</p>
<p style='margin-top:0;margin-bottom:10px;'>You could argue that I should not use bean names that conflict with other pre-defined XML elements, but:</p>
<ul>
<li>This would be a very stupid limitation, because when I introduce my own bean property "maxProcessingTime", it would cause naming conflicts as soon as you introduce the same XML element one day.</li>
<li>When creating the XML schema representing your current syntax description, the XML schema processor immediately finds the ambiguity and complains about it:</li>
</ul>
<p style='margin-top:0;margin-bottom:10px;'> <xsd:complexType name="appender"><br/>
<xsd:sequence><br/>
<xsd:element name="layout" type="layout" minOccurs="0" /><br/>
<xsd:element name="encoder" type="encoder" minOccurs="0" maxOccurs="unbounded" /><br/>
<xsd:element name="filter" type="filter" minOccurs="0" maxOccurs="unbounded" /><br/>
<xsd:any processContents="skip" minOccurs="0" maxOccurs="unbounded" /><br/>
</xsd:sequence><br/>
<xsd:attribute name="name" type="xsd:ID" use="required" /><br/>
<xsd:attribute name="class" type="className" use="required" /><br/>
</xsd:complexType></p>
<p style='margin-top:0;margin-bottom:10px;'>>> cos-nonambig: "http://logback.qos.ch/":layout and WC<a href="##any">#any</a> (or elements from their substitution group) violate "Unique Particle Attribution". During validation against this schema, ambiguity would be created for those two particles.</p>
<p style='margin-top:0;margin-bottom:10px;'>For my local work I have found a workaround for this by introducing a separate namespace for all the bean properties, which eventually leads to a slightly modified XSD schema file and the following form of configuration files:</p>
<p style='margin-top:0;margin-bottom:10px;'><?xml version="1.0" encoding="UTF-8"?><br/>
<configuration xmlns="http://logback.qos.ch/"<br/>
xmlns:attr="http://logback.qos.ch/beanAttributes"<br/>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br/>
xsi:schemaLocation="http://logback.qos.ch/ logback.xsd"><br/>
<appender name="CLUSTER" class="ClusteredAppender"><br/>
<layout class="ch.qos.logback.classic.PatternLayout"><br/>
<pattern>...</pattern><br/>
</layout><br/>
<attr:layout>ROUNDROBIN</attr:layout><br/>
</appender><br/>
...<br/>
</configuration></p>
<p style='margin-top:0;margin-bottom:10px;'>Note the "attr:" prefix for my own layout element. This way I can distinguish a "layout" element that is part of your common XSD schema from "layout" elements that contains a value for an attribute of the my appender class.</p>
<p style='margin-top:0;margin-bottom:10px;'>However, this isn't a nice workaround, and I would propose a different syntax for logback.xml to define class specific properties, maybe something like this:</p>
<p style='margin-top:0;margin-bottom:10px;'><?xml version="1.0" encoding="UTF-8"?><br/>
<configuration xmlns="http://logback.qos.ch/"<br/>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br/>
xsi:schemaLocation="http://logback.qos.ch/ logback.xsd"><br/>
<appender name="CLUSTER" class="ClusteredAppender"><br/>
<layout class="ch.qos.logback.classic.PatternLayout"><br/>
<pattern>...</pattern><br/>
</layout><br/>
<beanProperties><br/>
<layout>ROUNDROBIN</layout><br/>
</beanProperties><br/>
</appender><br/>
...<br/>
</configuration></p>
<p style='margin-top:0;margin-bottom:10px;'>This way all impl-class specific XML elements are children of the beanProperties element, so there are no ambiguities anymore. The XSD schema description for this construct will also be absolutely valid.</p>
<p style='margin-top:0;margin-bottom:10px;'>Of course this does not only apply to the Appender / Layout example, but to all the XML elements where custom bean properties can be defined via XML child elements.</p>
</td>
</tr>
<tr valign="top">
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
<strong style="font-weight:normal;color:#505050;">Project:</strong>
</td>
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
<a style="color:#326ca6;" href="http://jira.qos.ch/browse/LOGBACK">logback</a>
</td>
</tr> <tr valign="top">
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
<strong style="font-weight:normal;color:#505050;">Priority:</strong>
</td>
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
<img src="http://jira.qos.ch/images/icons/priorities/major.png" height="16" width="16" border="0" align="absmiddle" alt="Major"> Major
</td>
</tr>
<tr valign="top">
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
<strong style="font-weight:normal;color:#505050;">Reporter:</strong>
</td>
<td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
<a class="user-hover" rel="spalme" id="email_spalme" href="http://jira.qos.ch/secure/ViewProfile.jspa?name=spalme" style="color:#326ca6;">Stefan Palme</a>
</td>
</tr> </table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td><!-- End #email-page -->
</tr>
<tr valign="top">
<td style="color:#505050;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:10px;line-height:14px;padding: 0 16px 16px 16px;text-align:center;">
This message is automatically generated by JIRA.<br />
If you think it was sent incorrectly, please contact your JIRA administrators<br />
For more information on JIRA, see: <a style='color:#326ca6;' href='http://www.atlassian.com/software/jira'>http://www.atlassian.com/software/jira</a>
</td>
</tr>
</table><!-- End #email-wrap -->
</div><!-- End #email-body -->