Skip to content

Cake.Bakery logging output does not get displayed in VS Code #164

@nikola-nignite

Description

@nikola-nignite

Cake.Bakery logging is not turned on when it gets launched by OmniSharp.

Cake.Scripting.Transport.Tcp.Client.ScriptGenerationProcess will never pass --verbose argument to Cake.Bakery.exe.

Reason:

  1. Cake.Scripting.Transport uses LoggerFactory which is passed to it by OmniSharp.
  2. Bakery ScriptGenerationProcess expects following condition to be met in order to enable verbose logging:
if (_logger.IsEnabled(LogLevel.Debug))
{
    arguments += " --verbose";
}
  1. OmniSharp has logging filter which will never enable any logging from non OmniSharp namespaces as follows (CompositionHostBuilder.cs):
services.AddLogging(builder =>
{
    var workspaceInformationServiceName = typeof(WorkspaceInformationService).FullName;
    var projectEventForwarder = typeof(ProjectEventForwarder).FullName;

    builder.AddFilter(
        (category, logLevel) =>
            environment.LogLevel <= logLevel &&
// NOTICE BELOW LINE. Condition from point #1 of this bug report will always return false. Category is Cake.Scripting.Transport.Tcp.Client.ScriptGenerationProcess
            category.StartsWith("OmniSharp", StringComparison.OrdinalIgnoreCase) &&
            !category.Equals(workspaceInformationServiceName, StringComparison.OrdinalIgnoreCase) &&
            !category.Equals(projectEventForwarder, StringComparison.OrdinalIgnoreCase));

    configureLogging?.Invoke(builder);
});

This could be considered a bug either in OmniSharp (due to log filter) or Cake.Bakery ScriptGenerationProcess.

Some options are:

  • Allow external configuration of logging, beside command line
  • For assembles which are hosted in OmniSharp process, rename namespaces to start with OmniSharp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions