VS2013 - Coded UI Tests - how to disable logging - visual-studio-2013

After migrating my coded ui test from VS2012 to VS2013 I'm facing a debug trace logging problem. What ever the used configuration I still getting debug trace messages !!!
I did add the following configuration :
<system.diagnostics>
<switches>
<!-- Trace settings for MTR -->
<!-- Change the value to change the level of tracing you want.
You must use integral values for "value".
0 ==> off,
1 ==> error,
2 ==> warn,
3 ==> info,
4 ==> verbose.
Note that each value is inclusive of the last.
-->
<add name="UITestTraceLevel" value="0" />
<add name="EqtTraceLevel" value="0" />
<add name="TestManagement" value="0" />
<add name="TeamBuild" value="0" />
<add name="TeamFoundationSoapProxy" value="0" />
</switches>
<trace autoflush="true"/>
to all the following files :
project configuration file
QTAgent.exe.config
QTAgent_35.exe.config
QTAgent_40.exe.config
QTAgent32.exe.config
QTAgent32_35.exe.config
QTAgent32_40.exe.config
Did any one have any hint or a workaround to disable this debug trace ?

Make sure that this is set to NO
<appSettings>
<add key="CreateTraceListener" value="no"/>

Related

Transform app.config entries only if a flag in app.debug.config is true

I would like to perform an xdt:Transform when in Debug configuration but only if the value of an entry in app.debug.config is a certain value, lets say true to keep it simple. For example:
App.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add key="Value.First" value="foo" />
<add key="Value.Second" value="foo" />
<add key="Value.Third" value="foo" />
</appSettings>
</configuration>
App.Debug.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<!--Convenient flag to indicate if transform should happen-->
<add key="Perform.Transform.If.True" value="true" xdt:Transform="Insert" />
<!--Should only happen if the above is true-->
<add key="Value.First" value="bar" xdt:Transform="SetAttributes" xdt:Locator="Match(key)" />
<add key="Value.Second" value="bar" xdt:Transform="SetAttributes" xdt:Locator="Match(key)" />
<add key="Value.Third" value="bar" xdt:Transform="SetAttributes" xdt:Locator="Match(key)" />
</appSettings>
</configuration>
I would like all of the Value.* entries in app.config to be transformed only if the key Perform.Transform.If.True is set to true. If it is false nothing should happen. The reason being that sometimes during testing we would like to quickly turn things on and off which are controlled by the config files.
I have seen the options for Locator for things like Match, Conditional, XPath, etc. but none seem to allow for a condition from another entry. Can that be done with slowcheetah/xdt transforms?
Well, found a round-about way using XPath:
<add
key="Value.First"
value="bar"
xdt:Transform="Replace"
xdt:Locator="XPath(//appSettings/add[#key='Perform.Transform.If.True' and translate(#value, 'ERTU', 'ertu')='true']/../add[#key='Value.First'])"
/>
If the flag is not true it will fail to resolve the path. The translate makes it case-insensitive.
Failing to resolve (is false) leads to compile warnings which is annoying but since this is a debug tool we can live with that.

Where is the package sources location

I use VS 2015 .Where in the visual studio project store the setting of Tools>options >Nuget Package Manager >Package Sources's setting. Currently Nuget.org is checked for Package Sources.I want to point this to a different location other than https://www.nuget.org/api/v2/, by editing the file location.
I checked the project file csproj, but did not find it
I need to change this manually in the server to point to the server repository. Working fine in local machine but not in the server.
This is a per-user setting, and is stored in %APPDATA%\NuGet\NuGet.Config. The file looks like:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="Abc" value="http://def/nuget/" />
<add key="Package source" value="http://packagesource" />
</packageSources>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<bindingRedirects>
<add key="skip" value="False" />
</bindingRedirects>
</configuration>
Simply add another entry into the <packageSources> element. (Mine is obviously updated for the protocol version 3 and so is referencing https://api.nuget.org/v3/index.json rather than https://www.nuget.org/api/v2/).

web.config transform: not the debug.cofig values when debugging locally

I am trying to change the values of some appsetting keys while running locally.
So, i have my original Web.config which has thoses keys
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="config" value="Release" />
</appSettings>
I am trying to change the value of "config" key in the web.debug.config,
<?xml version="1.0"?>
<!-- For more information on using Web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=301874 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add key="config" value="Debug" xdt:Transform="Replace" xdt:Locator="Match(key)" />
</appSettings>
<system.web>
</system.web>
</configuration>
When, i am running the project locally using VS:
I am printing the value of config and is always showing the value from web.config, however when i click preview transformation on web.debug.config, its showing this:
how can i make it work locally by picking information from web.debug.config?

I've created web application with cloud service, windows azure,right now i am deploying my web role on more then 2 environment

I've implemented authentication in my web application, Now problem is like at the time of deployment i've to do some manual settings in web.config file
like; every time if i want to deploy on test then i've to uncomment local testing settings and comment to production setting and vice versa, so is there any way that i can change these settings runtime or dynamically at the time of deployment? because i've lots of environment to publish so every time do manually comment and uncomment of setting is not worthy
<!--LOCAL TESTING-->
<add key="idaFederationMetadataLocation" value="https://login.windows.net/test.onmicrosoft.com/testMetadata/2007-06/testMetadata.xml" />
<add key="idaRealm" value="https://test.onmicrosoft.com/AadTest" />
<add key="idaAudienceUri" value="https://test.onmicrosoft.com/admTest" />
<add key="idaClientID" value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
<add key="idaPassword" value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=" />
<!-- PRODUCTION -->
<!-- <add key="idaFederationMetadataLocation" value="https://login.windows.net/test.onmicrosoft.com/testMetadata/2007-06/testMetadata.xml" />
<add key="idaRealm" value="https://test.onmicrosoft.com/AadTest" />
<add key="idaAudienceUri" value="https://test.onmicrosoft.com/admTest" />
<add key="idaClientID" value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
<add key="idaPassword" value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=" />-->
So you just need to comment one line in release version of your web.config?
You can use Web.Config Transformation. Add the following line to you Web.Release.config file:
<add key="idaFederationMetadataLocation" xdt:Transform="Remove" xdt:Locator="Match(key)"/>

Where does log4net write log files when debugging a web application through Visual Studio?

I'm trying to add log4net logging to a web application I'm writing. I've got this in a web service method:
log4net.Config.XmlConfigurator.Configure();
log4net.ILog log = log4net.LogManager.GetLogger(typeof(Methods));
log.Info("Some information");
And this in the web.config file:
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Windows" />
<identity impersonate="true"/>
</system.web>
<log4net>
<appender name="LogFileAppender" type="log4net.Appender.RollFileAppender">
<file value="log.txt" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="1MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.SimpleLayout" />
</appender>
<root>
<level value="ALL" />
<appender-ref ref="LogFileAppender" />
</root>
</log4net>
I was expecting the log file to appear in the bin\ directory when I debug it through Visual Studio 2010, but nothing is written there. The method runs successfully without any exceptions, but I can't find the log file. Any ideas as to where it should appear?
Edit - Some extra info:
According to the notification area icon, the ASP.Net Development Server is running in:
C:\Users\jpope\Documents\Visual Studio 2010\Projects\WebApplication1\WebApplication1\
The permissions on this directory and the \bin\ sub-directory both give SYSTEM, me and Administrators full control, and no one else any access. The log file is not in the directory shown above or the \bin\ sub-directory.
If you're willing to wade into some low-level stuff, it might be interesting to see what Process Monitor thinks the web server process is trying to write to. At least it would be more fun than wading through the log4net documentation.
Maybe you should set the asp.net user has the write right for you web directory.
This turned out to be a configuration problem. Switching to a FileAppender instead of a RollFileAppender works fine. Now I need to find out what's wrong with the RollFileAppender configuration...
Edit: It's a RollingFileAppender, not a RollFileAppender.

Resources