June 7th, 2012

Enable C++ and Javascript project system tracing

Andrew Arnott
Principal Software Engineer

I’ve previously posted on how to enable logging in the C++ project system in Visual Studio 2010.  In Visual Studio 2012 we’ve changed the way the Common Project System (aka “CPS”) emits trace messages so below I introduce an updated xml snippet that works in Visual Studio 2012.  Since CPS is now the project system driving JavaScript as well, the below xml snippet impacts that as well.

To enable tracing, add the following xml block to devenv.exe.config file directly under the <configuration> root node, after the </configSections> end tag. Make sure to make a backup first so that you can revert back in case something goes wrong.  You may need to change “Warning” below with “Verbose” if you want verbose logging.

<system.diagnostics>
    <sources>
        <source name="CPS" switchName="CPS" switchType="System.Diagnostics.SourceSwitch">
            <listeners>
                <add name="cpsFileLogger"/>
            </listeners>
        </source>
    </sources>
    <switches>
        <add name="CPS" value="Warning"/>
    </switches>
    <sharedListeners>
        <add name="cpsFileLogger" type="System.Diagnostics.TextWriterTraceListener" initializeData="C:\Temp\devenv-cps.log">
            <filter type="System.Diagnostics.EventTypeFilter" initializeData="Warning"/>
        </add>
    </sharedListeners>
    <trace autoflush="true" indentsize="4" />
</system.diagnostics>

 

Author

Andrew Arnott
Principal Software Engineer

Principal Software Engineer and OSS contributor. Visual Studio Platform.

0 comments

Discussion are closed.