.bat file wont save a .log file when triggered in VBA - batch-file

Ok, so this is a somewhat complicated question, but hopefully somebody can help me out. I created a .bat file to help with batch process data uploads to SalesForce servers. I then tied excel macros to the .bat files by having the .bat files called in Excel VBA.
Here's my problem: Whenever the .bat files are called in VBA, the .log file isn't saved - it's not even executed (almost like the line of code didn't exist in the .bat file).
Now here's the weird part: if I just click on the .bat file to begin the upload process -- as opposed to calling the .bat from within VBA -- the .log file is overwritten and a new one is created.
How can I get the .bat file to save a .log regardless of whether its fired simply by clicking on the .bat file, or from within VBA? This is very frustrating - any and all help is greatly appreciated. Thank you.
Here's my MS-DOS (batch) code:
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org /dtd/spring-beans.dtd">
<beans>
<bean id="Update_Listing_Val_FNMA" class="com.salesforce.dataloader.process.ProcessRunner" singleton="false">
<description>Created by Dataloader Cliq.</description>
<property name="name" value="Update_Listing_Val_FNMA"/>
<property name="configOverrideMap">
<map>
<entry key="dataAccess.name" value="M:\My Folder\CSV Files\salesforce.com\Apex Data Loader 22.0\cliq_process\Update_Listing_Val_FNMA\read\Update_Listing_Val_FNMA.csv"/>
<entry key="dataAccess.readUTF8" value="true"/>
<entry key="dataAccess.type" value="csvRead"/>
<entry key="dataAccess.writeUTF8" value="true"/>
<entry key="process.enableExtractStatusOutput" value="true"/>
<entry key="process.enableLastRunOutput" value="true"/>
<entry key="process.lastRunOutputDirectory" value="M:\My Folder\CSV Files\salesforce.com\Apex Data Loader 22.0\cliq_process\Update_Listing_Val_FNMA\log"/>
<entry key="process.mappingFile" value="M:\My Folder\CSV Files\salesforce.com\Apex Data Loader 22.0\cliq_process\Update_Listing_Val_FNMA\config\Update_Listing_Val_FNMA.sdl"/>
<entry key="process.operation" value="update"/>
<entry key="process.statusOutputDirectory" value="M:\My Folder\CSV Files\salesforce.com\Apex Data Loader 22.0\cliq_process\Update_Listing_Val_FNMA\log"/>
<entry key="sfdc.bulkApiCheckStatusInterval" value="5000"/>
<entry key="sfdc.bulkApiSerialMode" value="5000"/>
<entry key="sfdc.debugMessages" value="false"/>
<entry key="sfdc.enableRetries" value="true"/>
<entry key="sfdc.endpoint" value="https://www.salesforce.com/services/Soap/u/22.0"/>
<entry key="sfdc.entity" value="QA_FNMA__c"/>
<entry key="sfdc.extractionRequestSize" value="500"/>
<entry key="sfdc.insertNulls" value="false"/>
<entry key="sfdc.loadBatchSize" value="100"/>
<entry key="sfdc.maxRetries" value="3"/>
<entry key="sfdc.minRetrySleepSecs" value="2"/>
<entry key="sfdc.noCompression" value="false"/>
<entry key="sfdc.password" value="XXXXXXXXXXXXXXXXXX"/>
<entry key="sfdc.proxyHost" value=""/>
<entry key="sfdc.proxyNtlmDomain" value=""/>
<entry key="sfdc.proxyPassword" value=""/>
<entry key="sfdc.proxyPort" value=""/>
<entry key="sfdc.proxyUsername" value=""/>
<entry key="sfdc.timeoutSecs" value="60"/>
<entry key="sfdc.useBulkApi" value="false"/>
<entry key="sfdc.username" value="XXXXXXXXXXXXXXXXXX"/>
</map>
</property>
</bean>
</beans>
** EDIT - 2/13/14 1649 **
Here's the call from VBA part:
Shell "M:\My Folder\XXXXXXXXXXXX\CSV Files\salesforce.com\Apex Data Loader 22.0\cliq_process\O PKG Status\Update_O_PKG_Status_REAC\Update_O_PKG_Status_REAC.bat"
Application.Wait (Now + TimeValue("0:00:12"))
Sheets("sheet5").Select
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:="M:\My Folder\XXXXXXXXXXXXXXX\CSV Files\salesforce.com\Apex Data Loader 22.0\cliq_process\O PKG Status\Update_O_PKG_Status_FNMA_Reactive\read\Update_O_PKG_Status_FNMA_Reactive", FileFormat:=xlCSV
newFileName = "FREAC O Pkg" & Format(Now, " MM-DD HHMM") & ".csv"
** EDIT - 2/18/14 1221 **
Here's the log-conf file; it's an XML doc.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration>
<appender name="fileAppender" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="log/sdl.log" />
<param name="Append" value="true" />
<param name="MaxFileSize" value="100KB" />
<param name="MaxBackupIndex" value="1" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%t] %C{2} %M (%F:%L) - %m%n"/>
</layout>
</appender>
<appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%t] %C{2} %M (%F:%L) - %m%n"/>
</layout>
</appender>
<category name="org.apache.log4j.xml">
<priority value="warn" />
<appender-ref ref="fileAppender" />
<appender-ref ref="STDOUT" />
</category>
<logger name="org.apache" >
<level value ="warn" />
</logger>
<root>
<priority value ="info" />
<appender-ref ref="fileAppender" />
<appender-ref ref="STDOUT" />
</root>
</log4j:configuration>
** EDIT - 2/19/14 1226 **
Here's the actual .batch file that is calling everything;
SET DLPATH="M:\My Folder\XXXXXXXXXXXXXXXXX\CSV Files\salesforce.com\Apex Data Loader 22.0"
SET DLCONF="M:\My Folder\XXXXXXXXXXXXXXXXX\CSV Files\salesforce.com\Apex Data Loader 22.0\cliq_process\Update_Listing_Val_FNMA\config"
SET DLDATA="M:\My Folder\XXXXXXXXXXXXXXXXX\CSV Files\salesforce.com\Apex Data Loader 22.0\cliq_process\Update_Listing_Val_FNMA\write"
call %DLPATH%\_jvm\bin\java.exe -cp %DLPATH%\DataLoader.jar -Dsalesforce.config.dir=%DLCONF% com.salesforce.dataloader.process.ProcessRunner process.name=Update_Listing_Val_FNMA
REM To rotate your export files, uncomment the line below
REM copy %DLDATA%\Update_Listing_Val_FNMA.csv %DLDATA%\%date:~10,4%%date:~7,2%%date:~4,2%-%time:~0,2%-Update_Listing_Val_FNMA.csv

Related

Missing method id attribute in generated WADL with ServiceMix 7 M3 and CXF

We are using ServiceMix 7.0.0.M3 and use the CXF WADL generator.
Now the generated WADL does not seem to have a 'id' attribute in the resource>method tags. For example, the 4th line in the following WADL does not have an 'id' attribute.
<resources base="http://localhost:8181/api/rest/box">
<resource path="/">
<resource path="boxes">
<method name="GET">
<request>
<param name="language" style="header" type="xs:string"/>
<param name="includeInactive" style="query" type="xs:boolean"/>
</request>
<response>
<representation mediaType="application/json;charset=utf-8" element="prefix1:BoxRestResponse"/>
</response>
</method>
</resource>
If I would have the WADL generated with Jersey, I would get an 'id' property, containing the name of the corresponding Java method.
<resources base="http://localhost:8181/api/rest/box">
<resource path="/">
<resource path="boxes">
<method name="GET" id="getBoxes">
<request>
<param name="language" style="header" type="xs:string"/>
<param name="includeInactive" style="query" type="xs:boolean"/>
</request>
<response>
<representation mediaType="application/json;charset=utf-8" element="prefix1:BoxRestResponse"/>
</response>
</method>
</resource>
One of our frontend development tools expects the 'id' attribute to be present.
Is it possible to configure the CXF WADL generator to include the method id attribute?
I found it. The id's are generated when adding the WadlGenerator configuration property 'addResourceAndMethodIds' to the CXF Blueprint file:
<bean id="wadlGenerator" class="org.apache.cxf.jaxrs.model.wadl.WadlGenerator">
<!-- properties: Method Summaries # https://cxf.apache.org/javadoc/latest/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.html -->
<property name="linkJsonToXmlSchema" value="true" />
<property name="useJaxbContextForQnames" value="true" />
<property name="addResourceAndMethodIds" value="true" />
</bean>

Log4j generate different files with the same content

I'm working with a Java application that integrates log4j. For a new development I would need that instead of generating a file I will generate two, one per country that is accessed from the application web. Both would have the same log records that are found throughout my application.
I configured the configuration using an .xml file:
<!-- Appenders -->
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="jeveris: %d{dd MMM yyyy HH:mm:ss,SSS} %-5p %c - %m%n" />
</layout>
</appender>
<appender name="One-Console" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="Console.log" />
<param name="Append" value="true" />
<param name="MaxFileSize" value="2MB" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{dd MMM yyyy HH:mm:ss,SSS} %-5p %c - %m%n" />
</layout>
</appender>
<category name="com.example.one.web">
<level value="debug" />
<appender-ref ref="One-Console" />
</category>
<root>
<appender-ref ref="console" />
<level value="debug" />
</root>
</log4j:configuration>
Could someone guide me, tell me if it is possible or help me find the solution?
Thank you.
If you want 2+ log files that will print the same content, then you could fine 2 different files in your tag like so:
<configuration status="OFF">
<Properties>
<Property name="log-path">/your/file/path/</Property>
<Property name="log-country-name1">Country1</Property>
<Property name="log-country-name2">Country2</Property>
<!-- more if necessary -->
<Property name="log-pattern">%d{ISO8601} %-5p [%t|%c{1}] %m\n</Property>
<Property name="rollover-strategy-max">5</Property>
<Property name="rolling-size-based">10 MB</Property>
</Properties>
<appenders>
<!--uncomment following if want to print to console as well -->
<!-- <Console name="Console" target="SYSTEM_OUT">
<PatternLayout>
<pattern>${log-pattern}</pattern>
</PatternLayout>
</Console> -->
<RollingFile name="INFO" fileName="${log-path}/${log-country-name1}-logger.log" filePattern="${log-path}/${log-project-name}-debug-%d-%i.log.zip">
<PatternLayout>
<pattern>${log-pattern}</pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="${rolling-size-based}" />
</Policies>
<DefaultRolloverStrategy max="${rollover-strategy-max}" />
</RollingFile>
<RollingFile name="INFO" fileName="${log-path}/UpdaterLocal-logger.log" filePattern="${log-path}/${log-country-name2}-debug-%d-%i.log.zip">
<PatternLayout>
<pattern>${log-pattern}</pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="${rolling-size-based}" />
</Policies>
<DefaultRolloverStrategy max="${rollover-strategy-max}" />
</RollingFile>
</appenders>
<Loggers>
<logger name="io.switchfour" level="trace" additivity="false">
<AppenderRef ref="INFO" level="info" />
</logger>
</Loggers>
The above will create /your/file/path/Country1-logger.log and /your/file/path/Country2-logger.log and will write all entries that are INFO or higher to both files. Your log file should be identical.

bundle stays in GracePeriod status

I am trying to instantiate a "cxf:cxfEndpoint" in my camel route. But the bundle stays in "GracePeriod" status with following log:
2016-11-10 11:03:07,598 | INFO | rint Extender: 1 | BlueprintContainerImpl | ? ? | 21 - org.apache.aries.blueprint.core - 1.4.2 | Bundle com.entreprise.example is waiting for namespace handlers [http://camel.apache.org/schema/blueprint]
And my camelContext.xml file is :
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws" xmlns:cxf="http://cxf.apache.org/blueprint/core"
xmlns:camel="http://camel.apache.org/schema/blueprint" xmlns:camelcxf="http://camel.apache.org/schema/blueprint/cxf"
xsi:schemaLocation=" http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://cxf.apache.org/blueprint/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd
http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd">
<camelcxf:cxfEndpoint id="fist"
serviceClass="com.entreprise.example.services.firstService"
address="http://localhost:8181/cxf/example/firstMsg">
<camelcxf:properties>
<entry key="dataFormat" value="POJO" />
<entry key="loggingFeatureEnabled" value="true" />
</camelcxf:properties>
</camelcxf:cxfEndpoint>
<camelcxf:cxfEndpoint id="second"
serviceClass="com.entreprise.example.services.secondService"
address="http://localhost:8181/cxf/example/secondMessage">
<camelcxf:properties>
<entry key="dataFormat" value="POJO" />
<entry key="loggingFeatureEnabled" value="true" />
</camelcxf:properties>
</camelcxf:cxfEndpoint>
<camelContext trace="false" id="example"
xmlns="http://camel.apache.org/schema/blueprint">
<route>
<from uri="cxf:bean:first" />
<to uri="cxf:bean:second" />
</route>
</camelContext>
Seems like you have really messed up with your blueprint schema declartions. Replace blueprint declaration with something like below
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:cxf="http://camel.apache.org/schema/blueprint/cxf"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
And use "cxf" instead of "camelcxf" as prefix for the Endpoint and Bean this will become more clear and redeable (though you are free to use any prefix you prefer to use).
Ok, to avoid confusion use as below, this will resolve the waiting for dependencies error:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.2.0"
xmlns:cxf="http://camel.apache.org/schema/blueprint/cxf" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<cxf:cxfEndpoint id="fist"
serviceClass="com.entreprise.example.services.firstService" address="http://localhost:8181/cxf/example/firstMsg">
<cxf:properties>
<entry key="dataFormat" value="POJO" />
<entry key="loggingFeatureEnabled" value="true" />
</cxf:properties>
</cxf:cxfEndpoint>
<cxf:cxfEndpoint id="second"
serviceClass="com.entreprise.example.services.secondService" address="http://localhost:8181/cxf/example/secondMessage">
<cxf:properties>
<entry key="dataFormat" value="POJO" />
<entry key="loggingFeatureEnabled" value="true" />
</cxf:properties>
</cxf:cxfEndpoint>
<camelContext trace="false" id="example"
xmlns="http://camel.apache.org/schema/blueprint">
<route>
<from uri="cxf:bean:first" />
<to uri="cxf:bean:second" />
</route>
</blueprint>

Multiple <wsse:Security> header getting added to SOAP Header : CXF Client Implementation

Have implemented a CXF client using WSDL which already has WS-SecurityPolicy defined within it . It is working fine otherwise and is used by a web application heavily.
But we observed in perf env that intermittently multiple wsse:Security header is getting added to the SOAP header resulting in failure. It is intermittent and not able to reproduce it in dev environment.
Here is the client configuration:
<jaxws:client
xmlns:tns="http://ws.soa.com/service/XYZ/XYZService/"
name="XYZPort" address="${XYZService.endPoint}"
serviceClass="com.soa.ws.service.XYZ.XYZService.XYZPortType"
serviceName="tns:XYZService">
<jaxws:properties>
<entry key="ws-security.username" value="${XYZService.auth.username}" />
<entry key="ws-security.callback-handler" value-ref="XYZServicePasswordCallback" />
</jaxws:properties>
<jaxws:inInterceptors>
<ref bean="logInBound" />
<ref bean="XYZServiceSOAPResponseInterceptor" />
</jaxws:inInterceptors>
<jaxws:outInterceptors>
<ref bean="logOutBound" />
<ref bean="XYZServiceSOAPRequestInterceptor" />
</jaxws:outInterceptors>
</jaxws:client>
<bean id="XYZServicePasswordCallback" class="com.services.client.XYZ.XYZServiceClientPasswordCallback" >
<property name="username" value="${XYZService.auth.username}" />
<property name="password" value="${XYZService.auth.password}" />
<!-- Decrypt key defined in keyfile.properties -->
<property name="secretKey" value="${key}" />
</bean>
Here is the Intermitttent issue. Security header added twice
<soap:Header>
<wsse:Security soap:mustUnderstand="1" xmlns:wsse="http://docs.oasis- open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-33466425961" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>test</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">XYZPwd</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
<wsse:Security soap:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-33466425962" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>test</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">XYZPwd</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>

SOQL query that extracts data that got updated in the last x hours

I'm using CLIq and scheduled a task that is supposed to run every x-hours.
My issue is that my SOQL query gets all the items from the database where I only need to extract the stuff that got updated in the last x-hours. How can I limit my query to that ?
This is my process-config.xml file.
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="AMP_AIMS" class="com.salesforce.dataloader.process.ProcessRunner" singleton="false">
<description>Created by Dataloader Cliq.</description>
<property name="name" value="AMP_AIMS"/>
<property name="configOverrideMap">
<map>
<entry key="dataAccess.name" value="...\AMP_AIMS\write\AMP_AIMS.csv"/>
<entry key="dataAccess.readUTF8" value="true"/>
<entry key="dataAccess.type" value="csvWrite"/>
<entry key="dataAccess.writeUTF8" value="true"/>
<entry key="process.enableExtractStatusOutput" value="true"/>
<entry key="process.enableLastRunOutput" value="true"/>
<entry key="process.lastRunOutputDirectory" value="...\AMP_AIMS\log"/>
<entry key="process.operation" value="extract"/>
<entry key="process.statusOutputDirectory" value="...\AMP_AIMS\log"/>
<entry key="sfdc.bulkApiCheckStatusInterval" value="5000"/>
<entry key="sfdc.bulkApiSerialMode" value="5000"/>
<entry key="sfdc.debugMessages" value="false"/>
<entry key="sfdc.enableRetries" value="true"/>
<entry key="sfdc.endpoint" value="https://test.salesforce.com/services/Soap/u/24.0"/>
<entry key="sfdc.entity" value="Agency_Profile__c"/>
<entry key="sfdc.extractionRequestSize" value="500"/>
<entry key="sfdc.extractionSOQL" value="Select a.Total_Annual_Sales__c, a.Market_Specialties__c, a.Market_Focus__c, a.Destination_Specialties__c, a.CreatedDate, a.Agency_Website__c, a.Agency_Business_Email__c From Agency_Profile__c a"/>
<entry key="sfdc.insertNulls" value="false"/>
<entry key="sfdc.loadBatchSize" value="100"/>
<entry key="sfdc.maxRetries" value="3"/>
<entry key="sfdc.minRetrySleepSecs" value="2"/>
<entry key="sfdc.noCompression" value="false"/>
<entry key="sfdc.password" value="blabla"/>
<entry key="sfdc.proxyHost" value=""/>
<entry key="sfdc.proxyNtlmDomain" value=""/>
<entry key="sfdc.proxyPassword" value=""/>
<entry key="sfdc.proxyPort" value=""/>
<entry key="sfdc.proxyUsername" value=""/>
<entry key="sfdc.timeoutSecs" value="60"/>
<entry key="sfdc.useBulkApi" value="false"/>
<entry key="sfdc.username" value="bla"/>
</map>
</property>
</bean>
</beans>
I was fine with sth similar to this in the past:
SELECT Total_Annual_Sales__c, Market_Specialties__c, Market_Focus__c, Destination_Specialties__c, CreatedDate, Agency_Website__c, Agency_Business_Email__c
FROM Agency_Profile__c
WHERE LastModifiedDate = TODAY AND HOUR_IN_DAY(LastModifiedDate) > 9
You'd shedule it to run at 12, then similar one at 3 PM...
Still not ideal because in case of failure of one of runs you'd want to catch up... so some scripting around the loader to save time of last succesful run is neccessary for a failsafe solution.

Resources