Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 of 5 tasks
hzeng-tfs opened this issue Jun 14, 2024 · 0 comments

Comments

@hzeng-tfs
Copy link

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

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

No branches or pull requests

1 participant