Freigeben über


Enabling logging to troubleshoot MDSModelDeploy.exe

In the situation where you are trying to deploy an MDS model via the package to your Master Data Services in SQL Server 2012 you can sometimes encounter failures. Sometimes it says “See exception details for more information.” and you want to get more context on the failure.

This failure is a pretty trivial one, but showing it for illustrative purposes:

MDS Error: 0 : Microsoft.MasterDataServices.Deployment.Utility.ModelDeployUtilityException: A new CustomerSample model cannot be created. There is already a model with the same name. at Microsoft.MasterDataServices.Deployment.Utility.ModelDeploy.DeployNew(String serviceName, String packageFile, String modelName) at Microsoft.MasterDataServices.Deployment.Utility.ModelDeploy.Main(String[] args) DateTime=2012-09-13T21:50:58.1158091Z

Example of MDSModelDeploy.exe command lines if you are curious:

https://blogs.msdn.com/b/jason_howell/archive/2011/12/15/deploying-mds-samples-in-sql-server-2012.aspx

 

Three techniques I would do to troubleshoot MDS deployment errors are

1. Turn on logging for the deployment utility as shown below.

2. Turn on MDS logging via the web server configuration file. Following this KB:

https://support.microsoft.com/kb/2423478

3. Run a SQL profiler trace to watch the stored procedures being run if necessary.

 

 

 

To get more detailed logging on the context of the failure, please follow these steps to enable the logging.

 

1. Launch Notepad.exe as elevated administrator.

image

 

2. Then in notepad, File > Open and point to the location of your MDS Deployment Wizard Configuration file...

"C:\Program Files\Microsoft SQL Server\110\Master Data Services\Configuration\MDSModelDeploy.exe.config"

image

 

3. Uncomment the LogFileListener XML tag line, by removing the comment markers on this line item.

In other words, remove the comments prefix <!-- and suffix –>

< add name="LogFileListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="MdsModelDeployTrace.log" traceOutputOptions="DateTime"/>

This is the output file name and you are saying to write to the text file for logging.

 

4. Change the logging level to ALL by replacing the word Off in this line.
< source name="MDS" switchType="System.Diagnostics.SourceSwitch" switchValue="All">

 

Example of notepad for steps 3 and 4:

image

 

Example of the text in the config file with logging turned on.

<?xml version="1.0"?> <configuration>     <system.diagnostics>         <sources>             <!-- Adjust the switch value to control the types of messages that should be logged. -->             <source name="MDS" switchType="System.Diagnostics.SourceSwitch" switchValue="All">                 <listeners>                     <!-- Enable and configure listeners as desired to obtain trace messages. –>                         <add name="LogFileListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="MdsModelDeployTrace.log" traceOutputOptions="DateTime"/>                       <!--<add name="EtwListener" type="System.Diagnostics.Eventing.EventProviderTraceListener, System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"initializeData="{F2A341B8-CA5F-49ad-B00C-A82D3FCF948B}"/>-->                     <!--<remove name="Default"/>-->                 </listeners>             </source>         </sources>         <trace autoflush="true" />     </system.diagnostics> </configuration>

 

5. Now save the edits. If you get access denied when saving, check if you have launched notepad as Administrator, since it is a Program Files folder it may be protected.

Close out of MDSModelDeploy.exe if you still have it running. Probably it had the error and returned to the prompt already. The application must start again from scratch to get the logging output. If you are back at the C:\ prompt, you don’t need to close out the window.

 

6. Repeat the original failure using the MDSModelDeploy.exe command line.

image

7. Now locate the log output and review the details.
C:\Program Files\Microsoft SQL Server\110\Master Data Services\Configuration\MdsModelDeployTrace.log

image

 

8. Later, you may reverse the logging setting changes to the config file by commenting out the LogFileListener line item (add <!-- and --> to surround the XML tag) and reverting back to the switchValue="OFF"

Hope this helps somebody out there! Jason

Comments

  • Anonymous
    May 18, 2018
    This is really valuable, Kudos!