New custom property in properties panel extension not reflect in bpmn diagram xml - bpmn

I’m adding some custom properties in the property panel like below,
I diable Id property in the General tab. Adding 2 new tabs Input and Output.
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="sample-diagram" targetNamespace="http://bpmn.io/schema/bpmn" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="Process_1" isExecutable="false">
<bpmn2:startEvent id="StartEvent_1">
<bpmn2:outgoing>Flow_0n4p9tk</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:task id="Activity_0d872w2">
<bpmn2:incoming>Flow_0n4p9tk</bpmn2:incoming>
</bpmn2:task>
<bpmn2:sequenceFlow id="Flow_0n4p9tk" sourceRef="StartEvent_1" targetRef="Activity_0d872w2" />
</bpmn2:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
<bpmndi:BPMNEdge id="Flow_0n4p9tk_di" bpmnElement="Flow_0n4p9tk">
<di:waypoint x="448" y="258" />
<di:waypoint x="500" y="258" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="412" y="240" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0d872w2_di" bpmnElement="Activity_0d872w2">
<dc:Bounds x="500" y="218" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>
See 2 screenshots I added new control in the property panel but XML not showing me if I download the diagram. What am I missing in it?
Note: My code is the same replica of the BPMN custom property panel example

I resolved the issue. I able to set input-output parameter in BPMN diagram using the following code,
set: function setValue(element, values, node) {
var b_obj = getBusinessObject(element);
var selectedValues = {};
selectedValues = values;
prop[_id] = selectedValues[_id];
var selectedName = dropdownOptions[parseInt(prop[_id])].name;
var bo = cmdHelper.updateBusinessObject(element, b_obj, prop);
var selectedInputParameter = bpmnFactory.create('camunda:InputParameter', {
name: selectedName,
value: prop[_id]
});
var inputOutput = bpmnFactory.create('camunda:InputOutput', {
inputParameters: [selectedInputParameter]
});
b_obj.extensionElements = b_obj.extensionElements || bpmnFactory.create('bpmn:ExtensionElements');
b_obj.extensionElements.get('values').push(inputOutput);
return bo;
}
I got a hint from here

Related

Quasar q-tabs: how to dynamically show/hide q-tab by code?

There is a dropdownlist, if user choose a option, some q-tab-panel will show/hide to make a response. But how can I dynamically set the q-tab-panel show/hide by code? Hope someone can make suggestions here. Thanks
<q-select filled
v-model="datasource.datasourcetype"
:options="datasource.options"
option-value="value"
option-label="label"
emit-value
map-options
:label="ui.datasourcetype" />
<q-tabs v-model="dataEntryTab"
dense
class="bg-grey-2 text-teal"
align="left">
<q-tab name="tabCustomized" v-if="dataentry.showOptionsTab" icon="mail" :label="ui.datasourceOptions" />
<q-tab name="tabEntryInfo" v-if="dataentry.showDataEntryTab" icon="alarm" :label="ui.datasourceEntryInfo" />
<q-tab name="tabCascadeField" v-if="dataentry.showCascadeFieldTab" icon="movie" :label="ui.datasourceCascadeField" />
</q-tabs>
<q-tab-panels v-model="dataEntryTab" animated>
<q-tab-panel name="tabCustomized">
<q-input :label="ui.dataentryOptions"
v-model="dataentry.options"
filled
type="textarea" />
</q-tab-panel>
<q-tab-panel name="tabEntryInfo">
</q-tab-panel>
<q-tab-panel name="tabCascadeField">
</q-tab-panel>
</q-tab-panels>
For example, there are 3 q-tabs, if the user only want to let 2 of them to show, and 1 of them to hide after a dropdown option selected.
There is an event #input about q-select, and we can trigger a model variable for every q-tab. It works for me
onDataSourceTypeChanged (event) {
var dstype = this.datasource.datasourcetype
if (dstype === 'datasourcetype.Customized') {
this.dataentry.showOptionsTab = true
this.dataentry.showDataEntryTab = false
this.dataentry.showCasacdeFieldTab = false
} else {
this.dataentry.showOptionsTab = false
this.dataentry.showDataEntryTab = true
this.dataentry.showCasacdeFieldTab = true
}
}

Get attributes from XML with more than one namespaces

I have this XML:
<?xml version="1.0" encoding="UTF-8" ?>
<cfdi:Comprobante xmlns:cfdi="http://www.sat.gob.mx/cfd/3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="3.3" Serie="NG" Folio="55" Fecha="2017-08-02T20:08:58" FormaPago="99" SubTotal="5861.73" Descuento="778.38" Moneda="MXN" Total="5083.35" TipoDeComprobante="N" MetodoPago="PUE" LugarExpedicion="08400" Sello="yAfYBR0/bvvFgq/hNL+DSTTPt+kNtsE3DzxagXvG0M/alfaUrjp73IySCEBHIeo4nNF4uoscqnRoIowwfQPnNwC4LL6iD77rfykF2hq+i6VzqAlvbx0aawZUAcJpjNVWyS3zjfa3rYeU1TpNBrhSuU8r+4BoBz3jr1pB7yyCIm4JbwzNqy0TvTjD1XXnpy6v74+eqIoZqWZoi3CyiCqMS2B3FEfDMiXTfVlZ/3/evLYc5WvFPpBsm61I+SBID/rHhJvLQLjJDUX7Myt177N41xptITkIKQCJAIV6XN7mRGJTHKA3h3F7tSZaei8+LeONO9ZtlUZGw4dzLhrpNk/tuA==" xsi:schemaLocation="http://www.sat.gob.mx/cfd/3 http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv33.xsd">
<cfdi:Emisor Rfc="BBBBBB" Nombre="S.A. de C.V." RegimenFiscal="601" />
<cfdi:Receptor Rfc="AAAAAAAA" Nombre="AZUCENA SAN " UsoCFDI="P01" />
<cfdi:Conceptos>
<cfdi:Concepto ClaveProdServ="84111505" Cantidad="1" ClaveUnidad="ACT" Descripcion="Pago de nómina" ValorUnitario="5861.73" Importe="5861.73" Descuento="778.38" />
</cfdi:Conceptos>
<cfdi:Complemento>
<nomina12:Nomina xmlns:nomina12="http://www.sat.gob.mx/nomina12" Version="1.2" TipoNomina="O" FechaPago="2017-07-16" FechaInicialPago="2017-07-01" FechaFinalPago="2017-08-15" NumDiasPagados="15.000" TotalPercepciones="5861.73" TotalDeducciones="778.38" xsi:schemaLocation="http://www.sat.gob.mx/nomina12 http://www.sat.gob.mx/sitio_internet/cfd/nomina/nomina12.xsd">
<nomina12:Emisor RegistroPatronal="Y6844621109" />
<nomina12:Receptor Curp="SASA850203MDFNNZ06" NumSeguridadSocial="39058519115" FechaInicioRelLaboral="2012-09-14" Antigüedad="P254W" TipoContrato="01" Sindicalizado="No" TipoJornada="03" TipoRegimen="02" NumEmpleado="073" Departamento="VENTAS" Puesto="GERENTE TIENDAS" RiesgoPuesto="1" PeriodicidadPago="04" SalarioBaseCotApor="183.33" SalarioDiarioIntegrado="356.57" ClaveEntFed="DIF" />
<nomina12:Percepciones TotalSueldos="5861.73" TotalGravado="5089.21" TotalExento="772.52">
<nomina12:Percepcion TipoPercepcion="001" Clave="0001" Concepto="Sueldos" ImporteGravado="1026.69" ImporteExento="0.00" />
<nomina12:Percepcion TipoPercepcion="020" Clave="0008" Concepto="Prima dominical" ImporteGravado="0" ImporteExento="78.36" />
<nomina12:Percepcion TipoPercepcion="001" Clave="0020" Concepto="Vacaciones" ImporteGravado="1466.69" ImporteExento="0" />
<nomina12:Percepcion TipoPercepcion="021" Clave="0009" Concepto="Prima Vacacional" ImporteGravado="0" ImporteExento="458.33" />
<nomina12:Percepcion TipoPercepcion="038" Clave="0022" Concepto="Bonos" ImporteGravado="1000" ImporteExento="0" />
<nomina12:Percepcion TipoPercepcion="028" Clave="0010" Concepto="Comisiones" ImporteGravado="1360" ImporteExento="0" />
<nomina12:Percepcion TipoPercepcion="019" Clave="0007" Concepto="Horas extras" ImporteGravado="235.83" ImporteExento="235.83">
<nomina12:HorasExtra Dias="2" TipoHoras="01" HorasExtra="2" ImportePagado="235.83" />
<nomina12:HorasExtra Dias="1" TipoHoras="02" HorasExtra="1" ImportePagado="235.83" />
</nomina12:Percepcion>
</nomina12:Percepciones>
<nomina12:Deducciones TotalOtrasDeducciones="122.73" TotalImpuestosRetenidos="655.65">
<nomina12:Deduccion TipoDeduccion="002" Clave="0013" Concepto="ISR" Importe="655.65" />
<nomina12:Deduccion TipoDeduccion="001" Clave="0012" Concepto="IMSS" Importe="122.73" />
</nomina12:Deducciones>
</nomina12:Nomina>
<tfd:TimbreFiscalDigital xmlns:tfd="http://www.sat.gob.mx/TimbreFiscalDigital" xsi:schemaLocation="http://www.sat.gob.mx/TimbreFiscalDigital http://www.sat.gob.mx/sitio_internet/cfd/timbrefiscaldigital/TimbreFiscalDigitalv11.xsd" Version="1.1" UUID="2A73927D-7E57-40C7-9A8B-2E062560AC9E" FechaTimbrado="2017-08-02T19:52:07" SelloCFD="yAfYBR0/bvvFgq/hNL+DSTTPt+kNtsE3DzxagXvG0M/alfaUrjp73IySCEBHIeo4nNF4uoscqnRoIowwfQPnNwC4LL6iD77rfykF2hq+i6VzqAlvbx0aawZUAcJpjNVWyS3zjfa3rYeU1TpNBrhSuU8r+4BoBz3jr1pB7yyCIm4JbwzNqy0TvTjD1XXnpy6v74+eqIoZqWZoi3CyiCqMS2B3FEfDMiXTfVlZ/3/evLYc5WvFPpBsm61I+SBID/rHhJvLQLjJDUX7Myt177N41xptITkIKQCJAIV6XN7mRGJTHKA3h3F7tSZaei8+LeONO9ZtlUZGw4dzLhrpNk/tuA==" NoCertificadoSAT="20001000000300022323" SelloSAT="FXfgRBNhWla+53sM4eGnMFbbmQFb6EIaWMt3GMaqXJn9XPxQ5DVNuz7oTJ+yUZV0ObM5myqzzsI4Zvx3g==" RfcProvCertif="EME000602QR9" />
</cfdi:Complemento>
</cfdi:Comprobante>
And I need to get the values of some attributes, I can get attributes from the node cfdi:Comprobante, but when I try to read an attribute from tfd:TimbreFiscalDigital I get object reference not set to an instance of an object.
Here is the code I'm using:
Dim doc As XmlDocument = New XmlDocument()
doc.Load("C:\Users\s_osr\Desktop\EjemplosCFDINomina12\HorasExtras\SIGN_XML_COMPROBANTE_3_0.xml")
Dim managerdoc As XmlNamespaceManager = New XmlNamespaceManager(doc.NameTable)
managerdoc.AddNamespace("cfdi", doc.DocumentElement.NamespaceURI)
managerdoc.AddNamespace("tfd", doc.DocumentElement.NamespaceURI)
Dim Sello As String = doc.SelectSingleNode("/cfdi:Comprobante/#Sello", managerdoc).InnerText
Dim SelloSat As String = doc.SelectSingleNode("/cfdi:Comprobante/cfdi:Complemento/tfd:TimbreFiscalDigital/#SelloSAT", managerdoc).InnerText
Sello is working, but I can´t get SelloSAT.
UPDATE:
Thanks to #Kaiido for the solution, the uri string for the second namespace:
managerdoc.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital")

Fetch data inside <mc:Choice Requires="wps"> (docx4j)

This is a typical structure of a <w:r> which contains shape(s).
<w:r w:rsidR="00D10BFA">
<w:rPr>
<w:noProof/>
<w:lang w:eastAsia="en-PH" />
</w:rPr>
<mc:AlternateContent>
<mc:Choice Requires="wps">
<w:drawing>
<wp:anchor distT="0" distB="0" distL="114300" distR="114300" simplePos="0" relativeHeight="251660288" behindDoc="0" locked="0" layoutInCell="1" allowOverlap="1">
<wp:simplePos x="0" y="0" />
<wp:positionH relativeFrom="column">
<wp:posOffset>2171700</wp:posOffset>
</wp:positionH>
<wp:positionV relativeFrom="paragraph">
<wp:posOffset>99203</wp:posOffset>
</wp:positionV>
<wp:extent cx="1943100" cy="1714500" />
<wp:effectExtent l="19050" t="19050" r="19050" b="19050" />
<wp:wrapNone/>
<wp:docPr id="2" name="Oval 2" />
<wp:cNvGraphicFramePr/>
<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
<a:graphicData uri="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">
<wps:wsp>
<wps:cNvSpPr/>
<wps:spPr>
<a:xfrm>
<a:off x="0" y="0" />
<a:ext cx="1943100" cy="1714500" />
</a:xfrm>
<a:prstGeom prst="ellipse">
<a:avLst/>
</a:prstGeom>
<a:solidFill>
<a:schemeClr val="accent4">
<a:lumMod val="75000" />
</a:schemeClr>
</a:solidFill>
<a:ln w="28575" cap="sq">
<a:solidFill>
<a:schemeClr val="accent6">
<a:lumMod val="75000" />
</a:schemeClr>
</a:solidFill>
</a:ln>
</wps:spPr>
<wps:style>
<a:lnRef idx="2">
<a:schemeClr val="accent1">
<a:shade val="50000" />
</a:schemeClr>
</a:lnRef>
<a:fillRef idx="1">
<a:schemeClr val="accent1" />
</a:fillRef>
<a:effectRef idx="0">
<a:schemeClr val="accent1" />
</a:effectRef>
<a:fontRef idx="minor">
<a:schemeClr val="lt1" />
</a:fontRef>
</wps:style>
<wps:txbx>
<w:txbxContent>
<w:p w:rsidR="00D10BFA" w:rsidRDefault="00D10BFA" w:rsidP="00D10BFA">
<w:pPr>
<w:jc w:val="center" />
</w:pPr>
<w:r>
<w:t>THEQUICKBROWNFOXJUMPSOVERTHELAZYDOG.THEQUICKBROWNFOXJUMPSOVERTHELAZYDOG.THEQUICKBROWFA</w:t>
</w:r>
</w:p>
</w:txbxContent>
</wps:txbx>
<wps:bodyPr rot="0" spcFirstLastPara="0" vertOverflow="overflow" horzOverflow="overflow" vert="horz" wrap="square" lIns="91440" tIns="45720" rIns="91440" bIns="45720" numCol="1" spcCol="0" rtlCol="0" fromWordArt="0" anchor="ctr" anchorCtr="0" forceAA="0" compatLnSpc="1">
<a:prstTxWarp prst="textNoShape">
<a:avLst/>
</a:prstTxWarp>
<a:noAutofit/>
</wps:bodyPr>
</wps:wsp>
</a:graphicData>
</a:graphic>
</wp:anchor>
</w:drawing>
</mc:Choice>
<mc:Fallback>
<w:pict>
<v:oval id="Oval 2" o:spid="_x0000_s1028" style="position:absolute;margin-left:171pt;margin-top:7.8pt;width:153pt;height:135pt;z-index:251660288;visibility:visible;mso-wrap-style:square;mso-wrap-distance-left:9pt;mso-wrap-distance-top:0;mso-wrap-distance-right:9pt;mso-wrap-distance-bottom:0;mso-position-horizontal:absolute;mso-position-horizontal-relative:text;mso-position-vertical:absolute;mso-position-vertical-relative:text;v-text-anchor:middle" o:gfxdata="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
AAAA
" fillcolor="#bf8f00 [2407]" strokecolor="#538135 [2409]" strokeweight="2.25pt">
<v:stroke joinstyle="miter" endcap="square" />
<v:textbox>
<w:txbxContent>
<w:p w:rsidR="00D10BFA" w:rsidRDefault="00D10BFA" w:rsidP="00D10BFA">
<w:pPr>
<w:jc w:val="center" />
</w:pPr>
<w:r>
<w:t>THEQUICKBROWNFOXJUMPSOVERTHELAZYDOG.THEQUICKBROWNFOXJUMPSOVERTHELAZYDOG.THEQUICKBROWFA</w:t>
</w:r>
</w:p>
</w:txbxContent>
</v:textbox>
</v:oval>
</w:pict>
</mc:Fallback>
</mc:AlternateContent>
It contains rPr and mc:AlternateContent. My problem here is that when I try to do r.getContent(), you would expect to have two elements rPr and mc:AlternateContent. But in actual result, you would only have pict, since the behavior goes like: r.getContent() only fetches elements inside the <mc:Fallback> tag.
What I want to have is, I want to retrieve <a:graphic> which is definitely inside <mc:Choice>.<w:drawing>.<wp:anchor>.
In general, the presence of an mc element causes an UnmarshalException, since it is invalid content according to the schemas used in docx4j.
When that happens, docx4j pre-processes the content through org/docx4j/jaxb/mc-preprocessor.xslt which usually selects the mc:Fallback content.
You have various options to override this behaviour:
easy: you can supply your own xslt, which does something different; see the property "docx4j.jaxb.JaxbValidationEventHandler" to point to its location
more complex and completely unsupported: alter the XSDs to allow mc namespace content in the element of interest, then regenerate the relevant classes using xsd
modify a jaxb implementation itself, to cope with how the markup compatibility mechanism works. This would be very cool!
For more, Google 'office openxml markup compatibility and extensibility' or try this TC45 final draft.

Dynamics CRM- update record of contact entity

I have created contact record using ASP.NET. Now I need to Check if the contact record exists. If exists, update the same record. Through advance find have downloaded FetchXML and added to my FetchXML variable. Please suggest the logic. Below is my code.
// Establish a connection to crm and get the connection proxy
string connectionString = "xyz; Username= xyz ;Password=xyz";
CrmConnection connect = CrmConnection.Parse(connectionString);
OrganizationService service;
using (service = new OrganizationService(connect))
{
WhoAmIRequest request = new WhoAmIRequest();
Guid userId = ((WhoAmIResponse)service.Execute(request)).UserId;
ContactDetails contact = new ContactDetails();
//Check if the contact record exists . If exists , update the same record.
//Fecthxml query
string fetchXml = #" <fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
<entity name='contact'>
<attribute name='fullname' />
<attribute name='parentcustomerid' />
<attribute name='telephone1' />
<attribute name='emailaddress1' />
<attribute name='contactid' />
<order attribute='fullname' descending='false' />
<filter type='and'>
<condition attribute= 'mobilephone' operator='not-null' />
</filter>
</entity>
</fetch>" ;
FetchExpression query = new FetchExpression(fetchXml);
EntityCollection results = service.RetrieveMultiple(query);
if (results.Entities.Count > 0)
{
Entity contactRecord = results[0];
contactRecord["firstname"] = contactInfo.FirstName;
contactRecord["lastname"] = contactInfo.LastName;
contactRecord["emailaddress1"] = contactInfo.EmailId;
contactRecord["mobilephone"] = contactInfo.MobilePhone;
contactRecord["address1_line1"] = contactInfo.Street1;
contactRecord["address1_line2"] = contactInfo.Street2;
contactRecord["address1_line3"] = contactInfo.Street3;
contactRecord["address1_city"] = contactInfo.City;
service.Update(contactRecord);
}
//Else, Create the contact record
else
{
Entity entity = new Entity();
entity.LogicalName = "contact";
entity["firstname"] = contactInfo.FirstName;
entity["lastname"] = contactInfo.LastName;
entity["emailaddress1"] = contactInfo.EmailId;
entity["mobilephone"] = contactInfo.MobilePhone;
entity["address1_line1"] = contactInfo.Street1;
entity["address1_line2"] = contactInfo.Street2;
entity["address1_line3"] = contactInfo.Street3;
entity["address1_city"] = contactInfo.City;
entity["address1_stateorprovince"] = contactInfo.State;
entity["address1_country"] = contactInfo.Country;
entity["spousesname"] = contactInfo.SpouseName;
entity["birthdate"] = contactInfo.Birthday;
entity["anniversary"] = contactInfo.Anniversary;
//Create entity gender with option value
if (contactInfo.Gender == "Male")
{
entity["gendercode"] = new OptionSetValue(1);
}
else
{
entity["gendercode"] = new OptionSetValue(2);
}
//entity["familystatuscode"] = contactInfo.MaritalStatus;
if (contactInfo.MaritalStatus == "Single")
{
entity["familystatuscode"] = new OptionSetValue(1);
}
else
{
entity["familystatuscode"] = new OptionSetValue(2);
}
service.Create(entity);
}
}
// Create the entity
your logic seems ok, with the exception of the FectchXML query. The way you have your code, you will always end up updating the first record retrieved that has its mobilephone field filled. That does not seem a good way to check if a contact already exists.
I suggest you to change the filter of your fetch. In your filter condition you have to use an attribute that represents uniqueness for all contacts.
Apart of this your code looks ok.
Like nunoalmeieda says, you need to have a better way to ascertain if the Contact already exists. A common way of identifying if the Contact already exists would be to check if the email address already exists as it is very unlikely that two people will have the same email address.
I have updated your basic code to show how it is done with FetchXML.
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="contact">
<attribute name='fullname' />
<attribute name='parentcustomerid' />
<attribute name='telephone1' />
<attribute name='emailaddress1' />
<attribute name='contactid' />
<order attribute="fullname" descending="false" />
<filter type="and">
<condition attribute="emailaddress1" operator="eq" value=contactInfo.EmailId />
</filter>
</entity>
</fetch>
The logic here is that I am checking if the value of emailaddress1 (field in the contact entity of CRM) is equal to the value of your contactInfo.EmailId. I am assuming that contactInfo is the record that you get from ASP.NET.
The rest of your code is fine (I have formatted it a bit to make the question more readable).

log4net: How to set logger file name dynamically?

This is a really common question, but I have not been able to get an answer to work. Here is my configuration file:
<?xml version="1.0" encoding="utf-8"?>
<log4net>
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<file value="CraneUserInterface.log" />
<appendToFile value="true" />
<maxSizeRollBackups value="90" />
<rollingStyle value="Size" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date - %message%newline" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="RollingFile" />
</root>
But I need to determine the actual logging file name at run time. I found a nice example here, but when I try to loop through the collection returned by the call to GetIterators(), I find that that collection is empty.
I need to change the name "CraneUserInterface.log" to "CraneUserInterface_1.log", or 2, or 3, depending on something the program reads at run time. How can I do that?
Here's my first pass at using the code presented in that sample:
static bool ChangeLogFileName(string AppenderName, string NewFilename)
{
// log4net.Repository.ILoggerRepository RootRep;
// RootRep = log4net.LogManager.GetRepository();
log4net.Repository.ILoggerRepository RootRep = m_logger.Logger.Repository;
foreach (log4net.Appender.IAppender iApp in RootRep.GetAppenders())
{
string appenderName = iApp.Name;
if (iApp.Name.CompareTo(AppenderName) == 0
&& iApp is log4net.Appender.FileAppender)
{
log4net.Appender.FileAppender fApp = (log4net.Appender.FileAppender)iApp;
fApp.File = NewFilename;
fApp.ActivateOptions();
return true; // Appender found and name changed to NewFilename
}
}
return false; // appender not found
}
Thanks very much!
What about to use "%property" to define a dynamic 'tag' to the file name (at runtime) ?
<file type="log4net.Util.PatternString" value="~/App_Data/%property{LogName}" />
Explained here: Best way to dynamically set an appender file path
you can use this function :
in this function first get file location that you set in webconfig and after that you can add any path that you want ! like Date ! our Customer ! or .....
WebConfig:
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="C:\\t4\\"/>
<appendToFile value="true"/>
<rollingStyle value="Composite"/>
<datePattern value="_yyyy-MM-dd.lo'g'"/>
<maxSizeRollBackups value="10"/>
<maximumFileSize value="1MB"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date User:%identity IP:%X{addr} Browser: %X{browser} Url: %X{url} [%thread] %-5level %c:%m%n"/>
</layout>
</appender>
Function:
public static void ChangeFileLocation(string _CustomerName,string _Project)
{
XmlConfigurator.Configure();
log4net.Repository.Hierarchy.Hierarchy h =(log4net.Repository.Hierarchy.Hierarchy)LogManager.GetRepository();
foreach (IAppender a in h.Root.Appenders)
{
if (a is FileAppender)
{
FileAppender fa = (FileAppender)a;
string sNowDate= DateTime.Now.ToLongDateString();
// Programmatically set this to the desired location here
string FileLocationinWebConfig = fa.File;
string logFileLocation = FileLocationinWebConfig + _Project + "\\" + _CustomerName + "\\" + sNowDate + ".log";
fa.File = logFileLocation;
fa.ActivateOptions();
break;
}
}
}
and result like this : C:\t4\TestProject\Customer1\Saturday, August 31, 2013.log