diff --git a/src/SimulationRunner.cc b/src/SimulationRunner.cc index 268e956cda..baa2712adc 100644 --- a/src/SimulationRunner.cc +++ b/src/SimulationRunner.cc @@ -1596,8 +1596,6 @@ void SimulationRunner::CreateEntities(const sdf::World &_world) this->entityCompMgr.ProcessRemoveEntityRequests(); this->entityCompMgr.ClearRemovedComponents(); - this->LoadLoggingPlugins(this->serverConfig); - // Load any additional plugins from the Server Configuration this->LoadServerPlugins(this->serverConfig.Plugins()); @@ -1653,6 +1651,11 @@ void SimulationRunner::CreateEntities(const sdf::World &_world) } this->LoadServerPlugins(defaultPlugins); + // Load logging plugins after all server plugins so that necessary + // plugins such as SceneBroadcaster are loaded first. This might be + // a bug or an assumption made in the logging plugins. + this->LoadLoggingPlugins(this->serverConfig); + }; // Store the initial state of the ECM; diff --git a/test/integration/log_system.cc b/test/integration/log_system.cc index f867ca731a..a2335cae56 100644 --- a/test/integration/log_system.cc +++ b/test/integration/log_system.cc @@ -774,6 +774,18 @@ TEST_F(LogSystemTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(RecordAndPlayback)) // Start server Server playServer(playServerConfig); + // Simulate a client + gz::transport::Node node; + std::atomic numMsgs = 0; + std::function mockClient = + [&](const msgs::SerializedStepMap &/*_res*/) + { + numMsgs++; + }; + using namespace std::placeholders; + EXPECT_TRUE(node.Subscribe( + "/world/default/state", mockClient)); + // Callback function for entities played back // Compare current pose being played back with the pose from the stateMsg test::Relay playbackPoseTester; @@ -837,6 +849,9 @@ TEST_F(LogSystemTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(RecordAndPlayback)) // checked in the playbackPoseTester playServer.Run(true, 500, false); + // The client should have received some messages. + EXPECT_NE(numMsgs, 0); + // Count the total number of state messages in the log file int nTotal{0}; for (auto it = batch.begin(); it != batch.end(); ++it, ++nTotal) { }