.Net Custom TraceListener.TraceEvent not working

We have a custom TraceListener (inherited from System.Diagnostics.TraceListener) that we use for our management of ASP.NET web applications. It works great - no problem. Then he suddenly stopped working in our development environment (TraceListener.TraceEvent () stopped firing). We are confused why he stopped working. The only changes that we really made to the code were added additional build configurations (Dev, Test, Stage, Prod). Previously, he had only Debug and Release.

I notice that when I test locally by building the Debug configuration, TraceListener.TraceEvent () starts just fine. When I switch to another build configuration (i.e. Test), TraceEvent () no longer runs. Here is a snippet of my .csproj web file:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
  <DebugSymbols>true</DebugSymbols>
  <DebugType>full</DebugType>
  <Optimize>false</Optimize>
  <OutputPath>bin\</OutputPath>
  <DefineConstants>TRACE;DEBUG;SkipPostSharp</DefineConstants>
  <ErrorReport>prompt</ErrorReport>
  <WarningLevel>4</WarningLevel>
  <ExcludeGeneratedDebugSymbol>false</ExcludeGeneratedDebugSymbol>
  <PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Dev|AnyCPU'">
  <OutputPath>bin\</OutputPath>
  <DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Test|AnyCPU'">
  <DebugSymbols>true</DebugSymbols>
  <DebugType>full</DebugType>
  <Optimize>false</Optimize>
  <OutputPath>bin\</OutputPath>
  <DefineConstants>TRACE;DEBUG;SkipPostSharp</DefineConstants>
  <ErrorReport>prompt</ErrorReport>
  <WarningLevel>4</WarningLevel>
  <ExcludeGeneratedDebugSymbol>false</ExcludeGeneratedDebugSymbol>
  <PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Stage|AnyCPU'">
  <OutputPath>bin\</OutputPath>
  <DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Prod|AnyCPU'">
  <OutputPath>bin\</OutputPath>
  <DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
  <OutputPath>bin\</OutputPath>
  <DefineConstants>TRACE</DefineConstants>
</PropertyGroup>

I'm not sure why changing the assembly configuration seems to disable our registration. Can someone point me in the right direction?

+5
source share
1 answer

I found out the problem. My code, which was called System.Diagnostics.TraceSource.TraceEvent () for broadcasting trace events, was in another project. I needed to enable THAT project tracking via:

<DefineConstants>TRACE</DefineConstants>

, , , (.. -). - /, System.Diagnostics.TraceSource.TraceEvent(), ( ) . .:)

+5

All Articles