Open sandboxFocusImprove this doc

DIA005: Logging Built in Developer Mode

Severity Warning
Reported by PostSharp.Patterns.Diagnostics
Message <Module> is being built with PostSharp Logging in developer mode. Unless you are using Flashtrace, no log records will be emitted if <Module> is executed after <ExpirationTime>. To emit log records without a time limit, remove the LoggingDeveloperMode property or set it to False: production mode requires a license that includes PostSharp Logging. If you are using Flashtrace, ignore this message and suppress it by adding <PostSharpDisabledMessages>DIA005</PostSharpDisabledMessages> to your .csproj file.

Cause

PostSharp Logging has two modes. Production mode, the default, requires a license that includes PostSharp Logging. Developer mode is free, but the logging of the assembly stops 24 hours after it was built. See Licensing of PostSharp Logging: Production vs Developer Mode.

When the LoggingDeveloperMode property of PostSharp is True, typically set in postsharp.config, PostSharp builds the logging aspects of the project in developer mode and reports DIA005 once for the project, without a location. <Module> is the file name of the module being built, and <ExpirationTime> is the local time at which the logging stops, one day after the build. From that time on, the application keeps working, but PostSharp Logging replaces the backends of LoggingServices with a backend that discards the records, except when a backend is Flashtrace or forwards the records to Flashtrace.

The message contains the time of the build, which changes at every build, so no example can show it.

Resolution

  • To log without a time limit, build in production mode: remove the LoggingDeveloperMode property, or set it to False, and use a license that includes PostSharp Logging. A build server does not need a license key when PostSharp detects that the build is unattended; see Using PostSharp on a Build Server.

  • To keep developer mode for local development, for example to diagnose an issue, keep the property and rebuild the project when its logging has stopped.

  • If your application logs to Flashtrace, its logging does not stop. Suppress the message by adding it to the PostSharpDisabledMessages property of the project:

    <PropertyGroup>
      <PostSharpDisabledMessages>$(PostSharpDisabledMessages);DIA005</PostSharpDisabledMessages>
    </PropertyGroup>
    

See Also

Reference

LoggingServices

Other Resources

Licensing of PostSharp Logging: Production vs Developer Mode
Configuring Projects Using postsharp.config
Using PostSharp on a Build Server