Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 2, 2025

Proposed changes

UaPublisher.PublishMessages() logs at Information level for every published message, flooding logs in high-throughput scenarios:

06/14/2024 09:15:57.423 UaPublisher - PublishNetworkMessage, WriterGroupId:1; success = True
06/14/2024 09:15:57.461 UaPublisher - PublishNetworkMessage, WriterGroupId:4; success = True
...

Changed LogInformation to LogDebug for the per-message log entry. Start/Stop operations remain at Information level.

Related Issues

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Enhancement (non-breaking change which adds functionality)
  • Test enhancement (non-breaking change to increase test coverage)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected, requires version increase of Nuget packages)
  • Documentation Update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc.
  • I have signed the CLA.
  • I ran tests locally with my changes, all passed.
  • I fixed all failing tests in the CI pipelines.
  • I fixed all introduced issues with CodeQL and LGTM.
  • I have added tests that prove my fix is effective or that my feature works and increased code coverage.
  • I have added necessary documentation (if appropriate).
  • Any dependent changes have been merged and published in downstream modules.

Further comments

Single-line change. Users can still see these messages by enabling Debug level logging.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 10.1.0.280
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/UA-.NETStandard/UA-.NETStandard/Tests/Opc.Ua.PubSub.Tests/bin/Debug/net10.0/Opc.Ua.PubSub.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/UA-.NETStandard/UA-.NETStandard/Tests/Opc.Ua.PubSub.Tests/bin/Debug/net10.0/Opc.Ua.PubSub.Tests.deps.json /home/REDACTED/work/UA-.NETStandard/UA-.NETStandard/Tests/Opc.Ua.PubSub.Tests/bin/Debug/net10.0/testhost.dll --port 46269 --endpoint 127.0.0.1:046269 --role client --parentprocessid 4431 --telemetryoptedin false (dns block)
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/UA-.NETStandard/UA-.NETStandard/Tests/Opc.Ua.PubSub.Tests/bin/Debug/net9.0/Opc.Ua.PubSub.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/UA-.NETStandard/UA-.NETStandard/Tests/Opc.Ua.PubSub.Tests/bin/Debug/net9.0/Opc.Ua.PubSub.Tests.deps.json /home/REDACTED/work/UA-.NETStandard/UA-.NETStandard/Tests/Opc.Ua.PubSub.Tests/bin/Debug/net9.0/testhost.dll --port 36111 --endpoint 127.0.0.1:036111 --role client --parentprocessid 4371 --telemetryoptedin false (dns block)
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/UA-.NETStandard/UA-.NETStandard/Tests/Opc.Ua.PubSub.Tests/bin/Debug/net8.0/Opc.Ua.PubSub.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/UA-.NETStandard/UA-.NETStandard/Tests/Opc.Ua.PubSub.Tests/bin/Debug/net8.0/Opc.Ua.PubSub.Tests.deps.json /home/REDACTED/work/UA-.NETStandard/UA-.NETStandard/Tests/Opc.Ua.PubSub.Tests/bin/Debug/net8.0/testhost.dll --port 41105 --endpoint 127.0.0.1:041105 --role client --parentprocessid 4370 --telemetryoptedin false (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Too many messages of "UaPublisher - PublishNetworkMessage, WriterGroupId:{0}; success = {1}" on log file</issue_title>
<issue_description>### Type of issue

  • Bug
  • Enhancement
  • Compliance
  • Question
  • Help wanted

Current Behavior

This method is called when publishing messages.

        private void PublishMessages()
        {
            try
            {
                IList<UaNetworkMessage> networkMessages = m_pubSubConnection.CreateNetworkMessages(m_writerGroupConfiguration, m_writerGroupPublishState);
                if (networkMessages != null)
                {
                    foreach (UaNetworkMessage uaNetworkMessage in networkMessages)
                    {
                        if (uaNetworkMessage != null)
                        {
                            bool success = m_pubSubConnection.PublishNetworkMessage(uaNetworkMessage);
                            Utils.Trace(Utils.TraceMasks.Information,
                                "UaPublisher - PublishNetworkMessage, WriterGroupId:{0}; success = {1}", m_writerGroupConfiguration.WriterGroupId, success.ToString());
                        }
                    }
                }
               
            }
            catch (Exception e)
            {
                // Unexpected exception in PublishMessages
                Utils.Trace(e, "UaPublisher.PublishMessages");
            }
        }

the Utils.Trace call sets Utils.TraceMasks.Information explicitly. This generates a lots of messages (whenever a MQTT message is published) on log file as INFO is a quite high on logging level.

06/14/2024 09:15:57.423 UaPublisher - PublishNetworkMessage, WriterGroupId:1; success = True
06/14/2024 09:15:57.461 UaPublisher - PublishNetworkMessage, WriterGroupId:4; success = True
06/14/2024 09:15:57.464 UaPublisher - PublishNetworkMessage, WriterGroupId:3; success = True
06/14/2024 09:15:57.486 UaPublisher - PublishNetworkMessage, WriterGroupId:2; success = True
06/14/2024 09:15:57.488 UaPublisher - PublishNetworkMessage, WriterGroupId:5; success = True
06/14/2024 09:16:02.476 UaPublisher - PublishNetworkMessage, WriterGroupId:1; success = True
06/14/2024 09:16:02.501 UaPublisher - PublishNetworkMessage, WriterGroupId:4; success = True
06/14/2024 09:16:02.504 UaPublisher - PublishNetworkMessage, WriterGroupId:3; success = True
06/14/2024 09:16:02.507 UaPublisher - PublishNetworkMessage, WriterGroupId:2; success = True
06/14/2024 09:16:02.525 UaPublisher - PublishNetworkMessage, WriterGroupId:5; success = True
06/14/2024 09:16:07.441 UaPublisher - PublishNetworkMessage, WriterGroupId:1; success = True
06/14/2024 09:16:07.528 UaPublisher - PublishNetworkMessage, WriterGroupId:2; success = True
06/14/2024 09:16:07.534 UaPublisher - PublishNetworkMessage, WriterGroupId:3; success = True
06/14/2024 09:16:07.537 UaPublisher - PublishNetworkMessage, WriterGroupId:4; success = True
06/14/2024 09:16:07.541 UaPublisher - PublishNetworkMessage, WriterGroupId:5; success = True

Expected Behavior

Downgrade to something equivalent to DEBUG to reduce the amount of logging.

The logging levels being used here seem different from usually fatal/error/warning/info/debug/trace. I am not sure what is the equivalent logging level to normal DEBUG, maybe Operation?.

Steps To Reproduce

  1. Compiling UA PubSub https://github.com/OPCFoundation/UA-.NETStandard/tree/master/Applications/ConsoleReferencePublisher
  2. Modify logging setting to Information on program.cs
        private static void InitializeLog()
        {
            // Initialize logger
            Utils.SetTraceLog("%CommonApplicationData%\\OPC Foundation\\Logs\\Quickstarts.ConsoleReferencePublisher.log.txt", true);
            Utils.SetTraceMask(Utils.TraceMasks.Information);
            Utils.SetTraceOutput(Utils.TraceOutput.DebugAndFile);
        }

  1. run publisher and you will find lots of "UaPublisher - PublishNetworkMessage" messages on log file.

Environment

- OS: Windows 10
- Environment:
- Runtime:
- Nuget Version:
- Component: PubSub
- Server:
- Client:

Anything else?

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Co-authored-by: romanett <7413710+romanett@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix excessive log messages on PublishNetworkMessage Downgrade PublishNetworkMessage log level from Information to Debug Dec 2, 2025
Copilot AI requested a review from romanett December 2, 2025 16:58
@romanett romanett marked this pull request as ready for review December 2, 2025 18:03
@marcschier marcschier merged commit e297529 into master Dec 3, 2025
130 of 159 checks passed
@romanett romanett deleted the copilot/fix-excess-log-messages branch December 3, 2025 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Too many messages of "UaPublisher - PublishNetworkMessage, WriterGroupId:{0}; success = {1}" on log file

4 participants