none
System.Diagnostics Tracing from Exchange 2013 Transport Agent RRS feed

  • Question

  • For some reason we cannot seem to get System.Diagnostics tracing to work at all from a custom Exchange Transport agent, either on Exchange 2010 or Exchange 2013. The transport agent is otherwise registering and working properly, we are able to connect to it with a remote debugger etc. and it does its job.

    This section has been added to the EdgeTransport.exe.config file:

    <system.diagnostics>
    		<switches>
    			<add name="TestTraceSwitch" value="4"/>
    		</switches>
    		<trace autoflush="true">
    			<listeners>
    				<add name="TextWriterTraceListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="TestAgentLog.log" />
    			</listeners>
    		</trace>
    	</system.diagnostics>

    We've also tried creating an event log trace listener from within code and verified with the debugger that it gets initialized and exists etc. The debugger is able to step over Trace.Write and Trace.Flush lines without error, even with unhandled exceptions turned on, but no trace file or event log entries are ever written.

    For the event log trace tracing, the event source was created manually beforehand to avoid permission issues. The tracing code and config has also been tested from a console app and it works as expected.

    Is there some limitation in the Exchange architecture that prevents tracing from working?

    Sunday, April 14, 2013 8:51 AM

All replies

  • The issue has been resolved. It was fixed by deleting and re-creating the event sources with the PowerShell commands Remove-EventLog and New-EventLog -LogName Application -Source "My Event Source".

    It turned out that a full reboot of the server was necessary for this change to take effect and the logs to start appearing. It is unclear why restarting the MsExchangeTransport service was not enough.

    Sunday, April 14, 2013 10:33 AM