diff --git a/.clang-tidy b/.clang-tidy
index 7a476aa..71e80a4 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -330,5 +330,6 @@
   - { key: readability-identifier-naming.ParameterCase, value: camelBack }
   - { key: readability-identifier-naming.NamespaceCase, value: lower_case }
   - { key: readability-identifier-naming.StructCase,    value: CamelCase  }
+  - { key: readability-identifier-naming.FunctionIgnoredRegexp,  value: (BMCWEB_LOG_DEBUG|BMCWEB_LOG_INFO|BMCWEB_LOG_WARNING|BMCWEB_LOG_ERROR|BMCWEB_LOG_CRITICAL) }
   - { key: cppcoreguidelines-macro-usage.AllowedRegexp, value: DEBUG*|NLOHMANN_JSON_SERIALIZE_ENUM }
   - { key: performance-unnecessary-value-param.AllowedTypes, value: ((segments_view)|(url_view)) }
diff --git a/http/app.hpp b/http/app.hpp
index 0f0f47b..d9c88b9 100644
--- a/http/app.hpp
+++ b/http/app.hpp
@@ -144,7 +144,7 @@
 
     void debugPrint()
     {
-        BMCWEB_LOG_DEBUG << "Routing:";
+        BMCWEB_LOG_DEBUG("Routing:");
         router.debugPrint();
     }
 
@@ -162,8 +162,8 @@
     App& ssl(std::shared_ptr<boost::asio::ssl::context>&& ctx)
     {
         sslContext = std::move(ctx);
-        BMCWEB_LOG_INFO << "app::ssl context use_count="
-                        << sslContext.use_count();
+        BMCWEB_LOG_INFO("app::ssl context use_count={}",
+                        sslContext.use_count());
         return *this;
     }
 
diff --git a/http/complete_response_fields.hpp b/http/complete_response_fields.hpp
index 1819db5..66a4bb7 100644
--- a/http/complete_response_fields.hpp
+++ b/http/complete_response_fields.hpp
@@ -20,8 +20,8 @@
 
 inline void completeResponseFields(const Request& req, Response& res)
 {
-    BMCWEB_LOG_INFO << "Response: " << ' ' << req.url().encoded_path() << ' '
-                    << res.resultInt();
+    BMCWEB_LOG_INFO("Response:  {} {}", req.url().encoded_path(),
+                    res.resultInt());
     addSecurityHeaders(req, res);
 
     authentication::cleanupTempSession(req);
diff --git a/http/http2_connection.hpp b/http/http2_connection.hpp
index dad5089..a63b234 100644
--- a/http/http2_connection.hpp
+++ b/http/http2_connection.hpp
@@ -66,7 +66,7 @@
 
         if (sendServerConnectionHeader() != 0)
         {
-            BMCWEB_LOG_ERROR << "send_server_connection_header failed";
+            BMCWEB_LOG_ERROR("send_server_connection_header failed");
             return;
         }
         doRead();
@@ -74,7 +74,7 @@
 
     int sendServerConnectionHeader()
     {
-        BMCWEB_LOG_DEBUG << "send_server_connection_header()";
+        BMCWEB_LOG_DEBUG("send_server_connection_header()");
 
         uint32_t maxStreams = 4;
         std::array<nghttp2_settings_entry, 2> iv = {
@@ -83,7 +83,7 @@
         int rv = ngSession.submitSettings(iv);
         if (rv != 0)
         {
-            BMCWEB_LOG_ERROR << "Fatal error: " << nghttp2_strerror(rv);
+            BMCWEB_LOG_ERROR("Fatal error: {}", nghttp2_strerror(rv));
             return -1;
         }
         return 0;
@@ -97,20 +97,20 @@
     {
         if (source == nullptr || source->ptr == nullptr)
         {
-            BMCWEB_LOG_DEBUG << "Source was null???";
+            BMCWEB_LOG_DEBUG("Source was null???");
             return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
         }
 
-        BMCWEB_LOG_DEBUG << "File read callback length: " << length;
+        BMCWEB_LOG_DEBUG("File read callback length: {}", length);
         // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
         Http2StreamData* str = reinterpret_cast<Http2StreamData*>(source->ptr);
         crow::Response& res = str->res;
 
-        BMCWEB_LOG_DEBUG << "total: " << res.body().size()
-                         << " send_sofar: " << str->sentSofar;
+        BMCWEB_LOG_DEBUG("total: {} send_sofar: {}", res.body().size(),
+                         str->sentSofar);
 
         size_t toSend = std::min(res.body().size() - str->sentSofar, length);
-        BMCWEB_LOG_DEBUG << "Copying " << toSend << " bytes to buf";
+        BMCWEB_LOG_DEBUG("Copying {} bytes to buf", toSend);
 
         std::string::iterator bodyBegin = res.body().begin();
         std::advance(bodyBegin, str->sentSofar);
@@ -120,7 +120,7 @@
 
         if (str->sentSofar >= res.body().size())
         {
-            BMCWEB_LOG_DEBUG << "Setting OEF flag";
+            BMCWEB_LOG_DEBUG("Setting OEF flag");
             *dataFlags |= NGHTTP2_DATA_FLAG_EOF;
             //*dataFlags |= NGHTTP2_DATA_FLAG_NO_COPY;
         }
@@ -138,7 +138,7 @@
 
     int sendResponse(Response& completedRes, int32_t streamId)
     {
-        BMCWEB_LOG_DEBUG << "send_response stream_id:" << streamId;
+        BMCWEB_LOG_DEBUG("send_response stream_id:{}", streamId);
 
         auto it = streams.find(streamId);
         if (it == streams.end())
@@ -175,7 +175,7 @@
         int rv = ngSession.submitResponse(streamId, hdr, &dataPrd);
         if (rv != 0)
         {
-            BMCWEB_LOG_ERROR << "Fatal error: " << nghttp2_strerror(rv);
+            BMCWEB_LOG_ERROR("Fatal error: {}", nghttp2_strerror(rv));
             close();
             return -1;
         }
@@ -201,7 +201,7 @@
 
     int onRequestRecv(int32_t streamId)
     {
-        BMCWEB_LOG_DEBUG << "on_request_recv";
+        BMCWEB_LOG_DEBUG("on_request_recv");
 
         auto it = streams.find(streamId);
         if (it == streams.end())
@@ -211,14 +211,14 @@
         }
 
         crow::Request& thisReq = it->second->req;
-        BMCWEB_LOG_DEBUG << "Handling " << &thisReq << " \""
-                         << thisReq.url().encoded_path() << "\"";
+        BMCWEB_LOG_DEBUG("Handling {} \"{}\"", logPtr(&thisReq),
+                         thisReq.url().encoded_path());
 
         crow::Response& thisRes = it->second->res;
 
         thisRes.setCompleteRequestHandler(
             [this, streamId](Response& completeRes) {
-            BMCWEB_LOG_DEBUG << "res.completeRequestHandler called";
+            BMCWEB_LOG_DEBUG("res.completeRequestHandler called");
             if (sendResponse(completeRes, streamId) != 0)
             {
                 close();
@@ -234,7 +234,7 @@
 
     int onFrameRecvCallback(const nghttp2_frame& frame)
     {
-        BMCWEB_LOG_DEBUG << "frame type " << static_cast<int>(frame.hd.type);
+        BMCWEB_LOG_DEBUG("frame type {}", static_cast<int>(frame.hd.type));
         switch (frame.hd.type)
         {
             case NGHTTP2_DATA:
@@ -255,15 +255,15 @@
                                          const nghttp2_frame* frame,
                                          void* userData)
     {
-        BMCWEB_LOG_DEBUG << "on_frame_recv_callback";
+        BMCWEB_LOG_DEBUG("on_frame_recv_callback");
         if (userData == nullptr)
         {
-            BMCWEB_LOG_CRITICAL << "user data was null?";
+            BMCWEB_LOG_CRITICAL("user data was null?");
             return NGHTTP2_ERR_CALLBACK_FAILURE;
         }
         if (frame == nullptr)
         {
-            BMCWEB_LOG_CRITICAL << "frame was null?";
+            BMCWEB_LOG_CRITICAL("frame was null?");
             return NGHTTP2_ERR_CALLBACK_FAILURE;
         }
         return userPtrToSelf(userData).onFrameRecvCallback(*frame);
@@ -281,10 +281,10 @@
                                            int32_t streamId,
                                            uint32_t /*unused*/, void* userData)
     {
-        BMCWEB_LOG_DEBUG << "on_stream_close_callback stream " << streamId;
+        BMCWEB_LOG_DEBUG("on_stream_close_callback stream {}", streamId);
         if (userData == nullptr)
         {
-            BMCWEB_LOG_CRITICAL << "user data was null?";
+            BMCWEB_LOG_CRITICAL("user data was null?");
             return NGHTTP2_ERR_CALLBACK_FAILURE;
         }
         auto stream = userPtrToSelf(userData).streams.find(streamId);
@@ -308,8 +308,8 @@
         std::string_view valueSv(reinterpret_cast<const char*>(value.data()),
                                  value.size());
 
-        BMCWEB_LOG_DEBUG << "on_header_callback name: " << nameSv << " value "
-                         << valueSv;
+        BMCWEB_LOG_DEBUG("on_header_callback name: {} value {}", nameSv,
+                         valueSv);
 
         switch (frame.hd.type)
         {
@@ -321,7 +321,7 @@
                 auto thisStream = streams.find(frame.hd.stream_id);
                 if (thisStream == streams.end())
                 {
-                    BMCWEB_LOG_ERROR << "Unknown stream" << frame.hd.stream_id;
+                    BMCWEB_LOG_ERROR("Unknown stream{}", frame.hd.stream_id);
                     close();
                     return -1;
                 }
@@ -338,7 +338,7 @@
                         boost::beast::http::string_to_verb(valueSv);
                     if (verb == boost::beast::http::verb::unknown)
                     {
-                        BMCWEB_LOG_ERROR << "Unknown http verb " << valueSv;
+                        BMCWEB_LOG_ERROR("Unknown http verb {}", valueSv);
                         close();
                         return -1;
                     }
@@ -365,22 +365,22 @@
     {
         if (userData == nullptr)
         {
-            BMCWEB_LOG_CRITICAL << "user data was null?";
+            BMCWEB_LOG_CRITICAL("user data was null?");
             return NGHTTP2_ERR_CALLBACK_FAILURE;
         }
         if (frame == nullptr)
         {
-            BMCWEB_LOG_CRITICAL << "frame was null?";
+            BMCWEB_LOG_CRITICAL("frame was null?");
             return NGHTTP2_ERR_CALLBACK_FAILURE;
         }
         if (name == nullptr)
         {
-            BMCWEB_LOG_CRITICAL << "name was null?";
+            BMCWEB_LOG_CRITICAL("name was null?");
             return NGHTTP2_ERR_CALLBACK_FAILURE;
         }
         if (value == nullptr)
         {
-            BMCWEB_LOG_CRITICAL << "value was null?";
+            BMCWEB_LOG_CRITICAL("value was null?");
             return NGHTTP2_ERR_CALLBACK_FAILURE;
         }
         return userPtrToSelf(userData).onHeaderCallback(*frame, {name, namelen},
@@ -392,7 +392,7 @@
         if (frame.hd.type == NGHTTP2_HEADERS &&
             frame.headers.cat == NGHTTP2_HCAT_REQUEST)
         {
-            BMCWEB_LOG_DEBUG << "create stream for id " << frame.hd.stream_id;
+            BMCWEB_LOG_DEBUG("create stream for id {}", frame.hd.stream_id);
 
             std::pair<boost::container::flat_map<
                           int32_t, std::unique_ptr<Http2StreamData>>::iterator,
@@ -409,15 +409,15 @@
                                             const nghttp2_frame* frame,
                                             void* userData)
     {
-        BMCWEB_LOG_DEBUG << "on_begin_headers_callback";
+        BMCWEB_LOG_DEBUG("on_begin_headers_callback");
         if (userData == nullptr)
         {
-            BMCWEB_LOG_CRITICAL << "user data was null?";
+            BMCWEB_LOG_CRITICAL("user data was null?");
             return NGHTTP2_ERR_CALLBACK_FAILURE;
         }
         if (frame == nullptr)
         {
-            BMCWEB_LOG_CRITICAL << "frame was null?";
+            BMCWEB_LOG_CRITICAL("frame was null?");
             return NGHTTP2_ERR_CALLBACK_FAILURE;
         }
         return userPtrToSelf(userData).onBeginHeadersCallback(*frame);
@@ -428,7 +428,7 @@
                                  size_t sendLength)
     {
         self->isWriting = false;
-        BMCWEB_LOG_DEBUG << "Sent " << sendLength;
+        BMCWEB_LOG_DEBUG("Sent {}", sendLength);
         if (ec)
         {
             self->close();
@@ -457,7 +457,7 @@
     ssize_t onSendCallback(nghttp2_session* /*session */, const uint8_t* data,
                            size_t length, int /* flags */)
     {
-        BMCWEB_LOG_DEBUG << "On send callback size=" << length;
+        BMCWEB_LOG_DEBUG("On send callback size={}", length);
         size_t copied = boost::asio::buffer_copy(
             sendBuffer.prepare(length), boost::asio::buffer(data, length));
         sendBuffer.commit(copied);
@@ -489,20 +489,20 @@
 
     void doRead()
     {
-        BMCWEB_LOG_DEBUG << this << " doRead";
+        BMCWEB_LOG_DEBUG("{} doRead", logPtr(this));
         adaptor.async_read_some(
             inBuffer.prepare(8192),
             [this, self(shared_from_this())](
                 const boost::system::error_code& ec, size_t bytesTransferred) {
-            BMCWEB_LOG_DEBUG << this << " async_read_some " << bytesTransferred
-                             << " Bytes";
+            BMCWEB_LOG_DEBUG("{} async_read_some {} Bytes", logPtr(this),
+                             bytesTransferred);
 
             if (ec)
             {
-                BMCWEB_LOG_ERROR << this
-                                 << " Error while reading: " << ec.message();
+                BMCWEB_LOG_ERROR("{} Error while reading: {}", logPtr(this),
+                                 ec.message());
                 close();
-                BMCWEB_LOG_DEBUG << this << " from read(1)";
+                BMCWEB_LOG_DEBUG("{} from read(1)", logPtr(this));
                 return;
             }
             inBuffer.commit(bytesTransferred);
@@ -513,13 +513,13 @@
                 std::span<const uint8_t> bufferSpan{
                     std::bit_cast<const uint8_t*>(bufferIt.data()),
                     bufferIt.size()};
-                BMCWEB_LOG_DEBUG << "http2 is getting " << bufferSpan.size()
-                                 << " bytes";
+                BMCWEB_LOG_DEBUG("http2 is getting {} bytes",
+                                 bufferSpan.size());
                 ssize_t readLen = ngSession.memRecv(bufferSpan);
                 if (readLen <= 0)
                 {
-                    BMCWEB_LOG_ERROR << "nghttp2_session_mem_recv returned "
-                                     << readLen;
+                    BMCWEB_LOG_ERROR("nghttp2_session_mem_recv returned {}",
+                                     readLen);
                     close();
                     return;
                 }
diff --git a/http/http_client.hpp b/http/http_client.hpp
index 07fa85d..d82c566 100644
--- a/http/http_client.hpp
+++ b/http/http_client.hpp
@@ -84,7 +84,7 @@
     defaultRetryHandler(unsigned int respCode)
 {
     // As a default, assume 200X is alright
-    BMCWEB_LOG_DEBUG << "Using default check for response code validity";
+    BMCWEB_LOG_DEBUG("Using default check for response code validity");
     if ((respCode < 200) || (respCode >= 300))
     {
         return boost::system::errc::make_error_code(
@@ -165,9 +165,8 @@
     void doResolve()
     {
         state = ConnState::resolveInProgress;
-        BMCWEB_LOG_DEBUG << "Trying to resolve: " << host << ":"
-                         << std::to_string(port)
-                         << ", id: " << std::to_string(connId);
+        BMCWEB_LOG_DEBUG("Trying to resolve: {}:{}, id: {}", host,
+                         std::to_string(port), std::to_string(connId));
 
         resolver.async_resolve(host, std::to_string(port),
                                std::bind_front(&ConnectionInfo::afterResolve,
@@ -180,19 +179,18 @@
     {
         if (ec || (endpointList.empty()))
         {
-            BMCWEB_LOG_ERROR << "Resolve failed: " << ec.message() << " "
-                             << host << ":" << std::to_string(port);
+            BMCWEB_LOG_ERROR("Resolve failed: {} {}:{}", ec.message(), host,
+                             std::to_string(port));
             state = ConnState::resolveFailed;
             waitAndRetry();
             return;
         }
-        BMCWEB_LOG_DEBUG << "Resolved " << host << ":" << std::to_string(port)
-                         << ", id: " << std::to_string(connId);
+        BMCWEB_LOG_DEBUG("Resolved {}:{}, id: {}", host, std::to_string(port),
+                         std::to_string(connId));
         state = ConnState::connectInProgress;
 
-        BMCWEB_LOG_DEBUG << "Trying to connect to: " << host << ":"
-                         << std::to_string(port)
-                         << ", id: " << std::to_string(connId);
+        BMCWEB_LOG_DEBUG("Trying to connect to: {}:{}, id: {}", host,
+                         std::to_string(port), std::to_string(connId));
 
         timer.expires_after(std::chrono::seconds(30));
         timer.async_wait(std::bind_front(onTimeout, weak_from_this()));
@@ -217,17 +215,17 @@
         timer.cancel();
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "Connect " << endpoint.address().to_string()
-                             << ":" << std::to_string(endpoint.port())
-                             << ", id: " << std::to_string(connId)
-                             << " failed: " << ec.message();
+            BMCWEB_LOG_ERROR("Connect {}:{}, id: {} failed: {}",
+                             endpoint.address().to_string(),
+                             std::to_string(endpoint.port()),
+                             std::to_string(connId), ec.message());
             state = ConnState::connectFailed;
             waitAndRetry();
             return;
         }
-        BMCWEB_LOG_DEBUG << "Connected to: " << endpoint.address().to_string()
-                         << ":" << std::to_string(endpoint.port())
-                         << ", id: " << std::to_string(connId);
+        BMCWEB_LOG_DEBUG(
+            "Connected to: {}:{}, id: {}", endpoint.address().to_string(),
+            std::to_string(endpoint.port()), std::to_string(connId));
         if (sslConn)
         {
             doSslHandshake();
@@ -265,15 +263,14 @@
         timer.cancel();
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "SSL Handshake failed -"
-                             << " id: " << std::to_string(connId)
-                             << " error: " << ec.message();
+            BMCWEB_LOG_ERROR("SSL Handshake failed - id: {} error: {}",
+                             std::to_string(connId), ec.message());
             state = ConnState::handshakeFailed;
             waitAndRetry();
             return;
         }
-        BMCWEB_LOG_DEBUG << "SSL Handshake successful -"
-                         << " id: " << std::to_string(connId);
+        BMCWEB_LOG_DEBUG("SSL Handshake successful - id: {}",
+                         std::to_string(connId));
         state = ConnState::connected;
         sendMessage();
     }
@@ -316,14 +313,14 @@
         timer.cancel();
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "sendMessage() failed: " << ec.message() << " "
-                             << host << ":" << std::to_string(port);
+            BMCWEB_LOG_ERROR("sendMessage() failed: {} {}:{}", ec.message(),
+                             host, std::to_string(port));
             state = ConnState::sendFailed;
             waitAndRetry();
             return;
         }
-        BMCWEB_LOG_DEBUG << "sendMessage() bytes transferred: "
-                         << bytesTransferred;
+        BMCWEB_LOG_DEBUG("sendMessage() bytes transferred: {}",
+                         bytesTransferred);
 
         recvMessage();
     }
@@ -370,28 +367,28 @@
         timer.cancel();
         if (ec && ec != boost::asio::ssl::error::stream_truncated)
         {
-            BMCWEB_LOG_ERROR << "recvMessage() failed: " << ec.message()
-                             << " from " << host << ":" << std::to_string(port);
+            BMCWEB_LOG_ERROR("recvMessage() failed: {} from {}:{}",
+                             ec.message(), host, std::to_string(port));
             state = ConnState::recvFailed;
             waitAndRetry();
             return;
         }
-        BMCWEB_LOG_DEBUG << "recvMessage() bytes transferred: "
-                         << bytesTransferred;
-        BMCWEB_LOG_DEBUG << "recvMessage() data: " << parser->get().body();
+        BMCWEB_LOG_DEBUG("recvMessage() bytes transferred: {}",
+                         bytesTransferred);
+        BMCWEB_LOG_DEBUG("recvMessage() data: {}", parser->get().body());
 
         unsigned int respCode = parser->get().result_int();
-        BMCWEB_LOG_DEBUG << "recvMessage() Header Response Code: " << respCode;
+        BMCWEB_LOG_DEBUG("recvMessage() Header Response Code: {}", respCode);
 
         // Make sure the received response code is valid as defined by
         // the associated retry policy
         if (connPolicy->invalidResp(respCode))
         {
             // The listener failed to receive the Sent-Event
-            BMCWEB_LOG_ERROR << "recvMessage() Listener Failed to "
-                                "receive Sent-Event. Header Response Code: "
-                             << respCode << " from " << host << ":"
-                             << std::to_string(port);
+            BMCWEB_LOG_ERROR(
+                "recvMessage() Listener Failed to "
+                "receive Sent-Event. Header Response Code: {} from {}:{}",
+                respCode, host, std::to_string(port));
             state = ConnState::recvFailed;
             waitAndRetry();
             return;
@@ -403,8 +400,7 @@
 
         // Keep the connection alive if server supports it
         // Else close the connection
-        BMCWEB_LOG_DEBUG << "recvMessage() keepalive : "
-                         << parser->keep_alive();
+        BMCWEB_LOG_DEBUG("recvMessage() keepalive : {}", parser->keep_alive());
 
         // Copy the response into a Response object so that it can be
         // processed by the callback function.
@@ -418,13 +414,13 @@
     {
         if (ec == boost::asio::error::operation_aborted)
         {
-            BMCWEB_LOG_DEBUG
-                << "async_wait failed since the operation is aborted";
+            BMCWEB_LOG_DEBUG(
+                "async_wait failed since the operation is aborted");
             return;
         }
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "async_wait failed: " << ec.message();
+            BMCWEB_LOG_ERROR("async_wait failed: {}", ec.message());
             // If the timer fails, we need to close the socket anyway, same as
             // if it expired.
         }
@@ -441,10 +437,9 @@
         if ((retryCount >= connPolicy->maxRetryAttempts) ||
             (state == ConnState::sslInitFailed))
         {
-            BMCWEB_LOG_ERROR << "Maximum number of retries reached."
-                             << " " << host << ":" << std::to_string(port);
-            BMCWEB_LOG_DEBUG << "Retry policy: "
-                             << connPolicy->retryPolicyAction;
+            BMCWEB_LOG_ERROR("Maximum number of retries reached. {}:{}", host,
+                             std::to_string(port));
+            BMCWEB_LOG_DEBUG("Retry policy: {}", connPolicy->retryPolicyAction);
 
             if (connPolicy->retryPolicyAction == "TerminateAfterRetries")
             {
@@ -470,10 +465,9 @@
 
         retryCount++;
 
-        BMCWEB_LOG_DEBUG << "Attempt retry after "
-                         << std::to_string(
-                                connPolicy->retryIntervalSecs.count())
-                         << " seconds. RetryCount = " << retryCount;
+        BMCWEB_LOG_DEBUG("Attempt retry after {} seconds. RetryCount = {}",
+                         std::to_string(connPolicy->retryIntervalSecs.count()),
+                         retryCount);
         timer.expires_after(connPolicy->retryIntervalSecs);
         timer.async_wait(std::bind_front(&ConnectionInfo::onTimerDone, this,
                                          shared_from_this()));
@@ -484,13 +478,13 @@
     {
         if (ec == boost::asio::error::operation_aborted)
         {
-            BMCWEB_LOG_DEBUG
-                << "async_wait failed since the operation is aborted"
-                << ec.message();
+            BMCWEB_LOG_DEBUG(
+                "async_wait failed since the operation is aborted{}",
+                ec.message());
         }
         else if (ec)
         {
-            BMCWEB_LOG_ERROR << "async_wait failed: " << ec.message();
+            BMCWEB_LOG_ERROR("async_wait failed: {}", ec.message());
             // Ignore the error and continue the retry loop to attempt
             // sending the event as per the retry policy
         }
@@ -508,15 +502,14 @@
         // not_connected happens sometimes so don't bother reporting it.
         if (ec && ec != boost::beast::errc::not_connected)
         {
-            BMCWEB_LOG_ERROR << host << ":" << std::to_string(port)
-                             << ", id: " << std::to_string(connId)
-                             << " shutdown failed: " << ec.message();
+            BMCWEB_LOG_ERROR("{}:{}, id: {} shutdown failed: {}", host,
+                             std::to_string(port), std::to_string(connId),
+                             ec.message());
         }
         else
         {
-            BMCWEB_LOG_DEBUG << host << ":" << std::to_string(port)
-                             << ", id: " << std::to_string(connId)
-                             << " closed gracefully";
+            BMCWEB_LOG_DEBUG("{}:{}, id: {} closed gracefully", host,
+                             std::to_string(port), std::to_string(connId));
         }
 
         if (retry)
@@ -549,15 +542,14 @@
     {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << host << ":" << std::to_string(port)
-                             << ", id: " << std::to_string(connId)
-                             << " shutdown failed: " << ec.message();
+            BMCWEB_LOG_ERROR("{}:{}, id: {} shutdown failed: {}", host,
+                             std::to_string(port), std::to_string(connId),
+                             ec.message());
         }
         else
         {
-            BMCWEB_LOG_DEBUG << host << ":" << std::to_string(port)
-                             << ", id: " << std::to_string(connId)
-                             << " closed gracefully";
+            BMCWEB_LOG_DEBUG("{}:{}, id: {} closed gracefully", host,
+                             std::to_string(port), std::to_string(connId));
         }
         shutdownConn(retry);
     }
@@ -583,9 +575,9 @@
             boost::beast::error_code ec{static_cast<int>(::ERR_get_error()),
                                         boost::asio::error::get_ssl_category()};
 
-            BMCWEB_LOG_ERROR << "SSL_set_tlsext_host_name " << host << ":"
-                             << port << ", id: " << std::to_string(connId)
-                             << " failed: " << ec.message();
+            BMCWEB_LOG_ERROR(
+                "SSL_set_tlsext_host_name {}:{}, id: {} failed: {}", host, port,
+                std::to_string(connId), ec.message());
             // Set state as sslInit failed so that we close the connection
             // and take appropriate action as per retry configuration.
             state = ConnState::sslInitFailed;
@@ -611,8 +603,8 @@
 
             if (!sslCtx)
             {
-                BMCWEB_LOG_ERROR << "prepareSSLContext failed - " << host << ":"
-                                 << port << ", id: " << std::to_string(connId);
+                BMCWEB_LOG_ERROR("prepareSSLContext failed - {}:{}, id: {}",
+                                 host, port, std::to_string(connId));
                 // Don't retry if failure occurs while preparing SSL context
                 // such as certificate is invalid or set cipher failure or set
                 // host name failure etc... Setting conn state to sslInitFailed
@@ -648,8 +640,8 @@
     {
         if (requestQueue.empty())
         {
-            BMCWEB_LOG_ERROR
-                << "setConnProps() should not have been called when requestQueue is empty";
+            BMCWEB_LOG_ERROR(
+                "setConnProps() should not have been called when requestQueue is empty");
             return;
         }
 
@@ -657,9 +649,9 @@
         conn.req = std::move(nextReq.req);
         conn.callback = std::move(nextReq.callback);
 
-        BMCWEB_LOG_DEBUG << "Setting properties for connection " << conn.host
-                         << ":" << std::to_string(conn.port)
-                         << ", id: " << std::to_string(conn.connId);
+        BMCWEB_LOG_DEBUG("Setting properties for connection {}:{}, id: {}",
+                         conn.host, std::to_string(conn.port),
+                         std::to_string(conn.connId));
 
         // We can remove the request from the queue at this point
         requestQueue.pop_front();
@@ -680,11 +672,10 @@
         // Reuse the connection to send the next request in the queue
         if (!requestQueue.empty())
         {
-            BMCWEB_LOG_DEBUG << std::to_string(requestQueue.size())
-                             << " requests remaining in queue for " << destIP
-                             << ":" << std::to_string(destPort)
-                             << ", reusing connnection "
-                             << std::to_string(connId);
+            BMCWEB_LOG_DEBUG(
+                "{} requests remaining in queue for {}:{}, reusing connnection {}",
+                std::to_string(requestQueue.size()), destIP,
+                std::to_string(destPort), std::to_string(connId));
 
             setConnProps(*conn);
 
@@ -744,14 +735,13 @@
 
                 if (conn->state == ConnState::idle)
                 {
-                    BMCWEB_LOG_DEBUG << "Grabbing idle connection "
-                                     << commonMsg;
+                    BMCWEB_LOG_DEBUG("Grabbing idle connection {}", commonMsg);
                     conn->sendMessage();
                 }
                 else
                 {
-                    BMCWEB_LOG_DEBUG << "Reusing existing connection "
-                                     << commonMsg;
+                    BMCWEB_LOG_DEBUG("Reusing existing connection {}",
+                                     commonMsg);
                     conn->doResolve();
                 }
                 return;
@@ -762,8 +752,8 @@
         // the queue
         if (connections.size() < connPolicy->maxConnections)
         {
-            BMCWEB_LOG_DEBUG << "Adding new connection to pool " << destIP
-                             << ":" << std::to_string(destPort);
+            BMCWEB_LOG_DEBUG("Adding new connection to pool {}:{}", destIP,
+                             std::to_string(destPort));
             auto conn = addConnection();
             conn->req = std::move(thisReq);
             conn->callback = std::move(cb);
@@ -771,16 +761,17 @@
         }
         else if (requestQueue.size() < maxRequestQueueSize)
         {
-            BMCWEB_LOG_ERROR << "Max pool size reached. Adding data to queue."
-                             << destIP << ":" << std::to_string(destPort);
+            BMCWEB_LOG_ERROR(
+                "Max pool size reached. Adding data to queue.{}:{}", destIP,
+                std::to_string(destPort));
             requestQueue.emplace_back(std::move(thisReq), std::move(cb));
         }
         else
         {
             // If we can't buffer the request then we should let the callback
             // handle a 429 Too Many Requests dummy response
-            BMCWEB_LOG_ERROR << destIP << ":" << std::to_string(destPort)
-                             << " request queue full.  Dropping request.";
+            BMCWEB_LOG_ERROR("{}:{} request queue full.  Dropping request.",
+                             destIP, std::to_string(destPort));
             Response dummyRes;
             dummyRes.result(boost::beast::http::status::too_many_requests);
             resHandler(dummyRes);
@@ -801,7 +792,8 @@
         std::shared_ptr<ConnectionPool> self = weakSelf.lock();
         if (!self)
         {
-            BMCWEB_LOG_CRITICAL << self << " Failed to capture connection";
+            BMCWEB_LOG_CRITICAL("{} Failed to capture connection",
+                                logPtr(self.get()));
             return;
         }
 
@@ -815,10 +807,9 @@
         auto& ret = connections.emplace_back(std::make_shared<ConnectionInfo>(
             ioc, id, connPolicy, destIP, destPort, useSSL, newId));
 
-        BMCWEB_LOG_DEBUG << "Added connection "
-                         << std::to_string(connections.size() - 1)
-                         << " to pool " << destIP << ":"
-                         << std::to_string(destPort);
+        BMCWEB_LOG_DEBUG("Added connection {} to pool {}:{}",
+                         std::to_string(connections.size() - 1), destIP,
+                         std::to_string(destPort));
 
         return ret;
     }
@@ -832,8 +823,8 @@
         id(idIn), connPolicy(connPolicyIn), destIP(destIPIn),
         destPort(destPortIn), useSSL(useSSLIn)
     {
-        BMCWEB_LOG_DEBUG << "Initializing connection pool for " << destIP << ":"
-                         << std::to_string(destPort);
+        BMCWEB_LOG_DEBUG("Initializing connection pool for {}:{}", destIP,
+                         std::to_string(destPort));
 
         // Initialize the pool with a single connection
         addConnection();
@@ -852,8 +843,8 @@
     // sendDataWithCallback()
     static void genericResHandler(const Response& res)
     {
-        BMCWEB_LOG_DEBUG << "Response handled with return code: "
-                         << std::to_string(res.resultInt());
+        BMCWEB_LOG_DEBUG("Response handled with return code: {}",
+                         std::to_string(res.resultInt()));
     }
 
   public:
diff --git a/http/http_connection.hpp b/http/http_connection.hpp
index cb252f9..b5d0d2e 100644
--- a/http/http_connection.hpp
+++ b/http/http_connection.hpp
@@ -68,8 +68,8 @@
 
         connectionCount++;
 
-        BMCWEB_LOG_DEBUG << this << " Connection open, total "
-                         << connectionCount;
+        BMCWEB_LOG_DEBUG("{} Connection open, total {}", logPtr(this),
+                         connectionCount);
     }
 
     ~Connection()
@@ -78,8 +78,8 @@
         cancelDeadlineTimer();
 
         connectionCount--;
-        BMCWEB_LOG_DEBUG << this << " Connection closed, total "
-                         << connectionCount;
+        BMCWEB_LOG_DEBUG("{} Connection closed, total {}", logPtr(this),
+                         connectionCount);
     }
 
     Connection(const Connection&) = delete;
@@ -97,9 +97,8 @@
             mtlsSession = verifyMtlsUser(req->ipAddress, ctx);
             if (mtlsSession)
             {
-                BMCWEB_LOG_DEBUG
-                    << this
-                    << " Generating TLS session: " << mtlsSession->uniqueId;
+                BMCWEB_LOG_DEBUG("{} Generating TLS session: {}", logPtr(this),
+                                 mtlsSession->uniqueId);
             }
         }
         return true;
@@ -126,7 +125,7 @@
                 static_cast<unsigned int>(id.length()));
             if (ret == 0)
             {
-                BMCWEB_LOG_ERROR << this << " failed to set SSL id";
+                BMCWEB_LOG_ERROR("{} failed to set SSL id", logPtr(this));
             }
         }
 
@@ -143,7 +142,8 @@
     {
         if (connectionCount >= 100)
         {
-            BMCWEB_LOG_CRITICAL << this << "Max connection count exceeded.";
+            BMCWEB_LOG_CRITICAL("{}Max connection count exceeded.",
+                                logPtr(this));
             return;
         }
 
@@ -183,8 +183,8 @@
             {
                 std::string_view selectedProtocol(
                     std::bit_cast<const char*>(alpn), alpnlen);
-                BMCWEB_LOG_DEBUG << "ALPN selected protocol \""
-                                 << selectedProtocol << "\" len: " << alpnlen;
+                BMCWEB_LOG_DEBUG("ALPN selected protocol \"{}\" len: {}",
+                                 selectedProtocol, alpnlen);
                 if (selectedProtocol == "h2")
                 {
                     auto http2 =
@@ -205,7 +205,7 @@
         crow::Request& thisReq = req.emplace(parser->release(), reqEc);
         if (reqEc)
         {
-            BMCWEB_LOG_DEBUG << "Request failed to construct" << reqEc;
+            BMCWEB_LOG_DEBUG("Request failed to construct{}", reqEc.message());
             res.result(boost::beast::http::status::bad_request);
             completeRequest(res);
             return;
@@ -226,11 +226,10 @@
             }
         }
 
-        BMCWEB_LOG_INFO << "Request: "
-                        << " " << this << " HTTP/" << thisReq.version() / 10
-                        << "." << thisReq.version() % 10 << ' '
-                        << thisReq.methodString() << " " << thisReq.target()
-                        << " " << thisReq.ipAddress.to_string();
+        BMCWEB_LOG_INFO("Request:  {} HTTP/{}.{} {} {} {}", logPtr(this),
+                        thisReq.version() / 10, thisReq.version() % 10,
+                        thisReq.methodString(), thisReq.target(),
+                        thisReq.ipAddress.to_string());
 
         res.isAliveHelper = [this]() -> bool { return isAlive(); };
 
@@ -248,7 +247,7 @@
                                                  req->method()) &&
             thisReq.session == nullptr)
         {
-            BMCWEB_LOG_WARNING << "Authentication failed";
+            BMCWEB_LOG_WARNING("Authentication failed");
             forward_unauthorized::sendUnauthorized(
                 req->url().encoded_path(),
                 req->getHeaderValue("X-Requested-With"),
@@ -258,7 +257,7 @@
         }
 #endif // BMCWEB_INSECURE_DISABLE_AUTHX
         auto asyncResp = std::make_shared<bmcweb::AsyncResp>();
-        BMCWEB_LOG_DEBUG << "Setting completion handler";
+        BMCWEB_LOG_DEBUG("Setting completion handler");
         asyncResp->res.setCompleteRequestHandler(
             [self(shared_from_this())](crow::Response& thisRes) {
             self->completeRequest(thisRes);
@@ -320,9 +319,8 @@
             adaptor.next_layer().close();
             if (mtlsSession != nullptr)
             {
-                BMCWEB_LOG_DEBUG
-                    << this
-                    << " Removing TLS session: " << mtlsSession->uniqueId;
+                BMCWEB_LOG_DEBUG("{} Removing TLS session: {}", logPtr(this),
+                                 mtlsSession->uniqueId);
                 persistent_data::SessionStore::getInstance().removeSession(
                     mtlsSession);
             }
@@ -371,7 +369,7 @@
     boost::system::error_code getClientIp(boost::asio::ip::address& ip)
     {
         boost::system::error_code ec;
-        BMCWEB_LOG_DEBUG << "Fetch the client IP address";
+        BMCWEB_LOG_DEBUG("Fetch the client IP address");
         boost::asio::ip::tcp::endpoint endpoint =
             boost::beast::get_lowest_layer(adaptor).remote_endpoint(ec);
 
@@ -379,8 +377,8 @@
         {
             // If remote endpoint fails keep going. "ClientOriginIPAddress"
             // will be empty.
-            BMCWEB_LOG_ERROR << "Failed to get the client's IP Address. ec : "
-                             << ec;
+            BMCWEB_LOG_ERROR("Failed to get the client's IP Address. ec : {}",
+                             ec);
             return ec;
         }
         ip = endpoint.address();
@@ -390,7 +388,7 @@
   private:
     void doReadHeaders()
     {
-        BMCWEB_LOG_DEBUG << this << " doReadHeaders";
+        BMCWEB_LOG_DEBUG("{} doReadHeaders", logPtr(this));
 
         // Clean up any previous Connection.
         boost::beast::http::async_read_header(
@@ -398,21 +396,21 @@
             [this,
              self(shared_from_this())](const boost::system::error_code& ec,
                                        std::size_t bytesTransferred) {
-            BMCWEB_LOG_DEBUG << this << " async_read_header "
-                             << bytesTransferred << " Bytes";
+            BMCWEB_LOG_DEBUG("{} async_read_header {} Bytes", logPtr(this),
+                             bytesTransferred);
             bool errorWhileReading = false;
             if (ec)
             {
                 errorWhileReading = true;
                 if (ec == boost::beast::http::error::end_of_stream)
                 {
-                    BMCWEB_LOG_WARNING
-                        << this << " Error while reading: " << ec.message();
+                    BMCWEB_LOG_WARNING("{} Error while reading: {}",
+                                       logPtr(this), ec.message());
                 }
                 else
                 {
-                    BMCWEB_LOG_ERROR
-                        << this << " Error while reading: " << ec.message();
+                    BMCWEB_LOG_ERROR("{} Error while reading: {}", logPtr(this),
+                                     ec.message());
                 }
             }
             else
@@ -431,7 +429,7 @@
             if (errorWhileReading)
             {
                 close();
-                BMCWEB_LOG_DEBUG << this << " from read(1)";
+                BMCWEB_LOG_DEBUG("{} from read(1)", logPtr(this));
                 return;
             }
 
@@ -440,7 +438,7 @@
             boost::asio::ip::address ip;
             if (getClientIp(ip))
             {
-                BMCWEB_LOG_DEBUG << "Unable to get client IP";
+                BMCWEB_LOG_DEBUG("Unable to get client IP");
             }
 #ifndef BMCWEB_INSECURE_DISABLE_AUTHX
             boost::beast::http::verb method = parser->get().method();
@@ -454,13 +452,13 @@
                     parser->content_length();
                 if (contentLength && *contentLength > loggedOutPostBodyLimit)
                 {
-                    BMCWEB_LOG_DEBUG << "Content length greater than limit "
-                                     << *contentLength;
+                    BMCWEB_LOG_DEBUG("Content length greater than limit {}",
+                                     *contentLength);
                     close();
                     return;
                 }
 
-                BMCWEB_LOG_DEBUG << "Starting quick deadline";
+                BMCWEB_LOG_DEBUG("Starting quick deadline");
             }
 #endif // BMCWEB_INSECURE_DISABLE_AUTHX
 
@@ -476,22 +474,22 @@
 
     void doRead()
     {
-        BMCWEB_LOG_DEBUG << this << " doRead";
+        BMCWEB_LOG_DEBUG("{} doRead", logPtr(this));
         startDeadline();
         boost::beast::http::async_read_some(
             adaptor, buffer, *parser,
             [this,
              self(shared_from_this())](const boost::system::error_code& ec,
                                        std::size_t bytesTransferred) {
-            BMCWEB_LOG_DEBUG << this << " async_read_some " << bytesTransferred
-                             << " Bytes";
+            BMCWEB_LOG_DEBUG("{} async_read_some {} Bytes", logPtr(this),
+                             bytesTransferred);
 
             if (ec)
             {
-                BMCWEB_LOG_ERROR << this
-                                 << " Error while reading: " << ec.message();
+                BMCWEB_LOG_ERROR("{} Error while reading: {}", logPtr(this),
+                                 ec.message());
                 close();
-                BMCWEB_LOG_DEBUG << this << " from read(1)";
+                BMCWEB_LOG_DEBUG("{} from read(1)", logPtr(this));
                 return;
             }
 
@@ -515,7 +513,7 @@
 
     void doWrite(crow::Response& thisRes)
     {
-        BMCWEB_LOG_DEBUG << this << " doWrite";
+        BMCWEB_LOG_DEBUG("{} doWrite", logPtr(this));
         thisRes.preparePayload();
         serializer.emplace(*thisRes.stringResponse);
         startDeadline();
@@ -523,25 +521,25 @@
                                         [this, self(shared_from_this())](
                                             const boost::system::error_code& ec,
                                             std::size_t bytesTransferred) {
-            BMCWEB_LOG_DEBUG << this << " async_write " << bytesTransferred
-                             << " bytes";
+            BMCWEB_LOG_DEBUG("{} async_write {} bytes", logPtr(this),
+                             bytesTransferred);
 
             cancelDeadlineTimer();
 
             if (ec)
             {
-                BMCWEB_LOG_DEBUG << this << " from write(2)";
+                BMCWEB_LOG_DEBUG("{} from write(2)", logPtr(this));
                 return;
             }
             if (!keepAlive)
             {
                 close();
-                BMCWEB_LOG_DEBUG << this << " from write(1)";
+                BMCWEB_LOG_DEBUG("{} from write(1)", logPtr(this));
                 return;
             }
 
             serializer.reset();
-            BMCWEB_LOG_DEBUG << this << " Clearing response";
+            BMCWEB_LOG_DEBUG("{} Clearing response", logPtr(this));
             res.clear();
             parser.emplace(std::piecewise_construct, std::make_tuple());
             parser->body_limit(httpReqBodyLimit); // reset body limit for
@@ -580,7 +578,8 @@
                 weakSelf.lock();
             if (!self)
             {
-                BMCWEB_LOG_CRITICAL << self << " Failed to capture connection";
+                BMCWEB_LOG_CRITICAL("{} Failed to capture connection",
+                                    logPtr(self.get()));
                 return;
             }
 
@@ -593,16 +592,18 @@
             }
             if (ec)
             {
-                BMCWEB_LOG_CRITICAL << self << " timer failed " << ec;
+                BMCWEB_LOG_CRITICAL("{} timer failed {}", logPtr(self.get()),
+                                    ec);
             }
 
-            BMCWEB_LOG_WARNING << self << "Connection timed out, closing";
+            BMCWEB_LOG_WARNING("{}Connection timed out, closing",
+                               logPtr(self.get()));
 
             self->close();
         });
 
         timerStarted = true;
-        BMCWEB_LOG_DEBUG << this << " timer started";
+        BMCWEB_LOG_DEBUG("{} timer started", logPtr(this));
     }
 
     Adaptor adaptor;
diff --git a/http/http_response.hpp b/http/http_response.hpp
index 93c90d7..c4f9366 100644
--- a/http/http_response.hpp
+++ b/http/http_response.hpp
@@ -66,8 +66,8 @@
 
     Response& operator=(Response&& r) noexcept
     {
-        BMCWEB_LOG_DEBUG << "Moving response containers; this: " << this
-                         << "; other: " << &r;
+        BMCWEB_LOG_DEBUG("Moving response containers; this: {}; other: {}",
+                         logPtr(this), logPtr(&r));
         if (this == &r)
         {
             return *this;
@@ -167,9 +167,9 @@
                  stringResponse->result() == status::no_content ||
                  stringResponse->result() == status::not_modified))
             {
-                BMCWEB_LOG_CRITICAL
-                    << this
-                    << " Response content provided but code was no-content or not_modified, which aren't allowed to have a body";
+                BMCWEB_LOG_CRITICAL(
+                    "{} Response content provided but code was no-content or not_modified, which aren't allowed to have a body",
+                    logPtr(this));
                 pSize = 0;
                 body().clear();
             }
@@ -179,7 +179,7 @@
 
     void clear()
     {
-        BMCWEB_LOG_DEBUG << this << " Clearing response containers";
+        BMCWEB_LOG_DEBUG("{} Clearing response containers", logPtr(this));
         stringResponse.emplace(response_type{});
         jsonValue = nullptr;
         completed = false;
@@ -216,14 +216,14 @@
         }
         if (completed)
         {
-            BMCWEB_LOG_ERROR << this << " Response was ended twice";
+            BMCWEB_LOG_ERROR("{} Response was ended twice", logPtr(this));
             return;
         }
         completed = true;
-        BMCWEB_LOG_DEBUG << this << " calling completion handler";
+        BMCWEB_LOG_DEBUG("{} calling completion handler", logPtr(this));
         if (completeRequestHandler)
         {
-            BMCWEB_LOG_DEBUG << this << " completion handler was valid";
+            BMCWEB_LOG_DEBUG("{} completion handler was valid", logPtr(this));
             completeRequestHandler(*this);
         }
     }
@@ -235,7 +235,7 @@
 
     void setCompleteRequestHandler(std::function<void(Response&)>&& handler)
     {
-        BMCWEB_LOG_DEBUG << this << " setting completion handler";
+        BMCWEB_LOG_DEBUG("{} setting completion handler", logPtr(this));
         completeRequestHandler = std::move(handler);
 
         // Now that we have a new completion handler attached, we're no longer
@@ -245,8 +245,8 @@
 
     std::function<void(Response&)> releaseCompleteRequestHandler()
     {
-        BMCWEB_LOG_DEBUG << this << " releasing completion handler"
-                         << static_cast<bool>(completeRequestHandler);
+        BMCWEB_LOG_DEBUG("{} releasing completion handler{}", logPtr(this),
+                         static_cast<bool>(completeRequestHandler));
         std::function<void(Response&)> ret = completeRequestHandler;
         completeRequestHandler = nullptr;
         completed = true;
diff --git a/http/http_server.hpp b/http/http_server.hpp
index 91de8db..dbb95b4 100644
--- a/http/http_server.hpp
+++ b/http/http_server.hpp
@@ -89,8 +89,8 @@
             return dateStr;
         };
 
-        BMCWEB_LOG_INFO << "bmcweb server is running, local endpoint "
-                        << acceptor->local_endpoint().address().to_string();
+        BMCWEB_LOG_INFO("bmcweb server is running, local endpoint {}",
+                        acceptor->local_endpoint().address().to_string());
         startAsyncWaitForSignal();
         doAccept();
     }
@@ -114,7 +114,7 @@
             fs::create_directories(certPath);
         }
         fs::path certFile = certPath / "server.pem";
-        BMCWEB_LOG_INFO << "Building SSL Context file=" << certFile.string();
+        BMCWEB_LOG_INFO("Building SSL Context file={}", certFile.string());
         std::string sslPemFile(certFile);
         ensuressl::ensureOpensslKeyPresentAndValid(sslPemFile);
         std::shared_ptr<boost::asio::ssl::context> sslContext =
@@ -130,21 +130,21 @@
             [this](const boost::system::error_code& ec, int signalNo) {
             if (ec)
             {
-                BMCWEB_LOG_INFO << "Error in signal handler" << ec.message();
+                BMCWEB_LOG_INFO("Error in signal handler{}", ec.message());
             }
             else
             {
                 if (signalNo == SIGHUP)
                 {
-                    BMCWEB_LOG_INFO << "Receivied reload signal";
+                    BMCWEB_LOG_INFO("Receivied reload signal");
                     loadCertificate();
                     boost::system::error_code ec2;
                     acceptor->cancel(ec2);
                     if (ec2)
                     {
-                        BMCWEB_LOG_ERROR
-                            << "Error while canceling async operations:"
-                            << ec2.message();
+                        BMCWEB_LOG_ERROR(
+                            "Error while canceling async operations:{}",
+                            ec2.message());
                     }
                     startAsyncWaitForSignal();
                 }
diff --git a/http/logging.hpp b/http/logging.hpp
index 368548f..bf5e42e 100644
--- a/http/logging.hpp
+++ b/http/logging.hpp
@@ -2,16 +2,119 @@
 
 #include "bmcweb_config.h"
 
-#include <algorithm>
-#include <array>
-#include <cstdio>
-#include <cstdlib>
-#include <ctime>
-#include <filesystem>
+#include <boost/system/error_code.hpp>
+#include <boost/url/pct_string_view.hpp>
+#include <boost/url/string_view.hpp>
+#include <boost/url/url.hpp>
+#include <nlohmann/json.hpp>
+
+#include <bit>
+#include <format>
 #include <iostream>
-#include <sstream>
-#include <string>
+#include <source_location>
 #include <string_view>
+#include <system_error>
+
+// Clang-tidy would rather these be static, but using static causes the template
+// specialization to not function.  Ignore the warning.
+// NOLINTBEGIN(readability-convert-member-functions-to-static, cert-dcl58-cpp)
+template <>
+struct std::formatter<boost::system::error_code>
+{
+    constexpr auto parse(std::format_parse_context& ctx)
+    {
+        return ctx.begin();
+    }
+
+    auto format(const boost::system::error_code& ec, auto& ctx) const
+    {
+        return std::format_to(ctx.out(), "{}", ec.what());
+    }
+};
+
+template <>
+struct std::formatter<boost::urls::pct_string_view>
+{
+    constexpr auto parse(std::format_parse_context& ctx)
+    {
+        return ctx.begin();
+    }
+    auto format(const boost::urls::pct_string_view& msg, auto& ctx) const
+    {
+        return std::format_to(ctx.out(), "{}",
+                              std::string_view(msg.data(), msg.size()));
+    }
+};
+
+template <>
+struct std::formatter<boost::urls::url>
+{
+    constexpr auto parse(std::format_parse_context& ctx)
+    {
+        return ctx.begin();
+    }
+    auto format(const boost::urls::url& msg, auto& ctx) const
+    {
+        return std::format_to(ctx.out(), "{}", std::string_view(msg.buffer()));
+    }
+};
+
+template <>
+struct std::formatter<boost::core::string_view>
+{
+    constexpr auto parse(std::format_parse_context& ctx)
+    {
+        return ctx.begin();
+    }
+    auto format(const boost::core::string_view& msg, auto& ctx) const
+    {
+        return std::format_to(ctx.out(), "{}", std::string_view(msg));
+    }
+};
+
+template <>
+struct std::formatter<void*>
+{
+    constexpr auto parse(std::format_parse_context& ctx)
+    {
+        return ctx.begin();
+    }
+    auto format(const void*& ptr, auto& ctx) const
+    {
+        return std::format_to(ctx.out(), "{}",
+                              std::to_string(std::bit_cast<size_t>(ptr)));
+    }
+};
+
+template <>
+struct std::formatter<nlohmann::json::json_pointer>
+{
+    constexpr auto parse(std::format_parse_context& ctx)
+    {
+        return ctx.begin();
+    }
+    auto format(const nlohmann::json::json_pointer& ptr, auto& ctx) const
+    {
+        return std::format_to(ctx.out(), "{}", ptr.to_string());
+    }
+};
+
+template <>
+struct std::formatter<nlohmann::json>
+{
+    static constexpr auto parse(std::format_parse_context& ctx)
+    {
+        return ctx.begin();
+    }
+    auto format(const nlohmann::json& json, auto& ctx) const
+    {
+        return std::format_to(
+            ctx.out(), "{}",
+            json.dump(-1, ' ', false,
+                      nlohmann::json::error_handler_t::replace));
+    }
+};
+// NOLINTEND(readability-convert-member-functions-to-static, cert-dcl58-cpp)
 
 namespace crow
 {
@@ -51,103 +154,83 @@
 constexpr crow::LogLevel bmcwebCurrentLoggingLevel =
     getLogLevelFromName(bmcwebLoggingLevel);
 
-class Logger
+struct FormatString
 {
-  private:
-    //
-    static std::string timestamp()
-    {
-        std::string date;
-        date.resize(32, '\0');
-        time_t t = time(nullptr);
+    std::string_view str;
+    std::source_location loc;
 
-        tm myTm{};
-
-        gmtime_r(&t, &myTm);
-
-        size_t sz = strftime(date.data(), date.size(), "%Y-%m-%d %H:%M:%S",
-                             &myTm);
-        date.resize(sz);
-        return date;
-    }
-
-  public:
-    Logger([[maybe_unused]] const std::string& prefix,
-           [[maybe_unused]] const std::string& filename,
-           [[maybe_unused]] const size_t line)
-    {
-        stringstream << "(" << timestamp() << ") [" << prefix << " "
-                     << std::filesystem::path(filename).filename() << ":"
-                     << line << "] ";
-    }
-    ~Logger()
-    {
-        stringstream << std::endl;
-        std::cerr << stringstream.str();
-    }
-
-    Logger(const Logger&) = delete;
-    Logger(Logger&&) = delete;
-    Logger& operator=(const Logger&) = delete;
-    Logger& operator=(const Logger&&) = delete;
-
-    //
-    template <typename T>
-    Logger& operator<<([[maybe_unused]] const T& value)
-    {
-        // Somewhere in the code we're implicitly casting an array to a
-        // pointer in logging code. It's non-trivial to find,
-        // so disable the check here for now
-        // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-array-to-pointer-decay)
-        stringstream << value;
-        return *this;
-    }
-
-    constexpr static LogLevel getCurrentLogLevel()
-    {
-        return bmcwebCurrentLoggingLevel;
-    }
-
-    constexpr static bool isLoggingEnabled()
-    {
-        return getCurrentLogLevel() >= crow::LogLevel::Debug;
-    }
-
-    constexpr static bool checkLoggingLevel(const LogLevel level)
-    {
-        return isLoggingEnabled() && (getCurrentLogLevel() <= level);
-    }
-
-  private:
-    //
-    std::ostringstream stringstream;
+    // NOLINTNEXTLINE(google-explicit-constructor)
+    FormatString(const char* strIn, const std::source_location& locIn =
+                                        std::source_location::current()) :
+        str(strIn),
+        loc(locIn)
+    {}
 };
+
+template <typename T>
+const void* logPtr(T p)
+{
+    static_assert(std::is_pointer<T>::value,
+                  "Can't use logPtr without pointer");
+    return std::bit_cast<const void*>(p);
+}
+
+template <LogLevel level>
+inline void vlog(const FormatString& format, std::format_args&& args)
+{
+    if constexpr (bmcwebCurrentLoggingLevel > level)
+    {
+        return;
+    }
+    constexpr size_t stringIndex = static_cast<size_t>(level);
+    static_assert(stringIndex < mapLogLevelFromName.size(),
+                  "Missing string for level");
+    constexpr std::string_view levelString =
+        mapLogLevelFromName[stringIndex].first;
+    std::string_view filename = format.loc.file_name();
+    if (filename.starts_with("../"))
+    {
+        filename = filename.substr(3);
+    }
+    std::cout << std::format("[{} {}:{}] ", levelString, filename,
+                             format.loc.line());
+    std::cout << std::vformat(format.str, args);
+    std::putc('\n', stdout);
+}
 } // namespace crow
 
-// Disable clang-tidy warnings about unused macros.
-// NOLINTBEGIN(cppcoreguidelines-macro-usage, clang-diagnostic-unused-macros)
+template <typename... Args>
+inline void BMCWEB_LOG_CRITICAL(const crow::FormatString& format,
+                                Args&&... args)
+{
+    crow::vlog<crow::LogLevel::Critical>(
+        format, std::make_format_args(std::forward<Args>(args)...));
+}
 
-// The logging functions currently use macros.  Now that we have c++20, ideally
-// they'd use source_location with fixed functions, but for the moment, disable
-// the check.
-#define BMCWEB_LOG_CRITICAL                                                    \
-    if constexpr (crow::Logger::checkLoggingLevel(crow::LogLevel::Critical))   \
-    crow::Logger("CRITICAL", __FILE__, __LINE__)
+template <typename... Args>
+inline void BMCWEB_LOG_ERROR(const crow::FormatString& format, Args&&... args)
+{
+    crow::vlog<crow::LogLevel::Error>(
+        format, std::make_format_args(std::forward<Args>(args)...));
+}
 
-#define BMCWEB_LOG_ERROR                                                       \
-    if constexpr (crow::Logger::checkLoggingLevel(crow::LogLevel::Error))      \
-    crow::Logger("ERROR", __FILE__, __LINE__)
+template <typename... Args>
+inline void BMCWEB_LOG_WARNING(const crow::FormatString& format, Args&&... args)
+{
+    crow::vlog<crow::LogLevel::Warning>(
+        format, std::make_format_args(std::forward<Args>(args)...));
+}
 
-#define BMCWEB_LOG_WARNING                                                     \
-    if constexpr (crow::Logger::checkLoggingLevel(crow::LogLevel::Warning))    \
-    crow::Logger("WARNING", __FILE__, __LINE__)
+template <typename... Args>
+inline void BMCWEB_LOG_INFO(const crow::FormatString& format, Args&&... args)
+{
+    crow::vlog<crow::LogLevel::Info>(
+        format, std::make_format_args(std::forward<Args>(args)...));
+}
 
-#define BMCWEB_LOG_INFO                                                        \
-    if constexpr (crow::Logger::checkLoggingLevel(crow::LogLevel::Info))       \
-    crow::Logger("INFO", __FILE__, __LINE__)
-
-#define BMCWEB_LOG_DEBUG                                                       \
-    if constexpr (crow::Logger::checkLoggingLevel(crow::LogLevel::Debug))      \
-    crow::Logger("DEBUG", __FILE__, __LINE__)
-
-// NOLINTEND(cppcoreguidelines-macro-usage, clang-diagnostic-unused-macros)
+template <typename... Args>
+inline void BMCWEB_LOG_DEBUG(const crow::FormatString& format, Args&&... args)
+{
+    crow::vlog<crow::LogLevel::Debug>(
+        format, std::make_format_args(std::forward<Args>(args)...));
+}
diff --git a/http/mutual_tls.hpp b/http/mutual_tls.hpp
index f8af0f6..9cd4cde 100644
--- a/http/mutual_tls.hpp
+++ b/http/mutual_tls.hpp
@@ -21,14 +21,14 @@
              .getAuthMethodsConfig()
              .tls)
     {
-        BMCWEB_LOG_DEBUG << "TLS auth_config is disabled";
+        BMCWEB_LOG_DEBUG("TLS auth_config is disabled");
         return nullptr;
     }
 
     X509_STORE_CTX* cts = ctx.native_handle();
     if (cts == nullptr)
     {
-        BMCWEB_LOG_DEBUG << "Cannot get native TLS handle.";
+        BMCWEB_LOG_DEBUG("Cannot get native TLS handle.");
         return nullptr;
     }
 
@@ -36,7 +36,7 @@
     X509* peerCert = X509_STORE_CTX_get_current_cert(ctx.native_handle());
     if (peerCert == nullptr)
     {
-        BMCWEB_LOG_DEBUG << "Cannot get current TLS certificate.";
+        BMCWEB_LOG_DEBUG("Cannot get current TLS certificate.");
         return nullptr;
     }
 
@@ -44,7 +44,7 @@
     int ctxError = X509_STORE_CTX_get_error(cts);
     if (ctxError != X509_V_OK)
     {
-        BMCWEB_LOG_INFO << "Last TLS error is: " << ctxError;
+        BMCWEB_LOG_INFO("Last TLS error is: {}", ctxError);
         return nullptr;
     }
     // Check that we have reached final certificate in chain
@@ -52,12 +52,13 @@
     if (depth != 0)
 
     {
-        BMCWEB_LOG_DEBUG << "Certificate verification in progress (depth "
-                         << depth << "), waiting to reach final depth";
+        BMCWEB_LOG_DEBUG(
+            "Certificate verification in progress (depth {}), waiting to reach final depth",
+            depth);
         return nullptr;
     }
 
-    BMCWEB_LOG_DEBUG << "Certificate verification of final depth";
+    BMCWEB_LOG_DEBUG("Certificate verification of final depth");
 
     // Verify KeyUsage
     bool isKeyUsageDigitalSignature = false;
@@ -68,7 +69,7 @@
 
     if ((usage == nullptr) || (usage->data == nullptr))
     {
-        BMCWEB_LOG_DEBUG << "TLS usage is null";
+        BMCWEB_LOG_DEBUG("TLS usage is null");
         return nullptr;
     }
 
@@ -88,9 +89,9 @@
 
     if (!isKeyUsageDigitalSignature || !isKeyUsageKeyAgreement)
     {
-        BMCWEB_LOG_DEBUG << "Certificate ExtendedKeyUsage does "
-                            "not allow provided certificate to "
-                            "be used for user authentication";
+        BMCWEB_LOG_DEBUG("Certificate ExtendedKeyUsage does "
+                         "not allow provided certificate to "
+                         "be used for user authentication");
         return nullptr;
     }
 
@@ -101,7 +102,7 @@
 
     if (extUsage == nullptr)
     {
-        BMCWEB_LOG_DEBUG << "TLS extUsage is null";
+        BMCWEB_LOG_DEBUG("TLS extUsage is null");
         return nullptr;
     }
 
@@ -121,9 +122,9 @@
     // Certificate has to have proper key usages set
     if (!isExKeyUsageClientAuth)
     {
-        BMCWEB_LOG_DEBUG << "Certificate ExtendedKeyUsage does "
-                            "not allow provided certificate to "
-                            "be used for user authentication";
+        BMCWEB_LOG_DEBUG("Certificate ExtendedKeyUsage does "
+                         "not allow provided certificate to "
+                         "be used for user authentication");
         return nullptr;
     }
     std::string sslUser;
@@ -136,14 +137,14 @@
 
     if (status == -1)
     {
-        BMCWEB_LOG_DEBUG << "TLS cannot get username to create session";
+        BMCWEB_LOG_DEBUG("TLS cannot get username to create session");
         return nullptr;
     }
 
     size_t lastChar = sslUser.find('\0');
     if (lastChar == std::string::npos || lastChar == 0)
     {
-        BMCWEB_LOG_DEBUG << "Invalid TLS user name";
+        BMCWEB_LOG_DEBUG("Invalid TLS user name");
         return nullptr;
     }
     sslUser.resize(lastChar);
diff --git a/http/nghttp2_adapters.hpp b/http/nghttp2_adapters.hpp
index 3c1f549..9f4dc91 100644
--- a/http/nghttp2_adapters.hpp
+++ b/http/nghttp2_adapters.hpp
@@ -99,7 +99,7 @@
     {
         if (nghttp2_session_server_new(&ptr, callbacks.get(), nullptr) != 0)
         {
-            BMCWEB_LOG_ERROR << "nghttp2_session_server_new failed";
+            BMCWEB_LOG_ERROR("nghttp2_session_server_new failed");
             return;
         }
     }
diff --git a/http/parsing.hpp b/http/parsing.hpp
index f16d890..839b51c 100644
--- a/http/parsing.hpp
+++ b/http/parsing.hpp
@@ -24,7 +24,7 @@
     if (!boost::iequals(contentType, "application/json") &&
         !boost::iequals(contentType, "application/json; charset=utf-8"))
     {
-        BMCWEB_LOG_WARNING << "Failed to parse content type on request";
+        BMCWEB_LOG_WARNING("Failed to parse content type on request");
 #ifndef BMCWEB_INSECURE_IGNORE_CONTENT_TYPE
         return JsonParseResult::BadContentType;
 #endif
@@ -32,7 +32,7 @@
     jsonOut = nlohmann::json::parse(req.body(), nullptr, false);
     if (jsonOut.is_discarded())
     {
-        BMCWEB_LOG_WARNING << "Failed to parse json in request";
+        BMCWEB_LOG_WARNING("Failed to parse json in request");
         return JsonParseResult::BadJsonData;
     }
 
diff --git a/http/routing.hpp b/http/routing.hpp
index 1b2c131..49a51f1 100644
--- a/http/routing.hpp
+++ b/http/routing.hpp
@@ -307,18 +307,20 @@
         {
             if (n->paramChildrens[i] != 0U)
             {
-                BMCWEB_LOG_DEBUG << std::string(
-                    2U * level, ' ') /*<< "("<<n->paramChildrens[i]<<") "*/;
+                BMCWEB_LOG_DEBUG(
+                    "{}({}{}",
+                    std::string(2U * level,
+                                ' ') /*, n->paramChildrens[i], ") "*/);
                 switch (static_cast<ParamType>(i))
                 {
                     case ParamType::STRING:
-                        BMCWEB_LOG_DEBUG << "<str>";
+                        BMCWEB_LOG_DEBUG("<str>");
                         break;
                     case ParamType::PATH:
-                        BMCWEB_LOG_DEBUG << "<path>";
+                        BMCWEB_LOG_DEBUG("<path>");
                         break;
                     case ParamType::MAX:
-                        BMCWEB_LOG_DEBUG << "<ERROR>";
+                        BMCWEB_LOG_DEBUG("<ERROR>");
                         break;
                 }
 
@@ -327,9 +329,9 @@
         }
         for (const Node::ChildMap::value_type& kv : n->children)
         {
-            BMCWEB_LOG_DEBUG
-                << std::string(2U * level, ' ') /*<< "(" << kv.second << ") "*/
-                << kv.first;
+            BMCWEB_LOG_DEBUG("{}({}{}{}",
+                             std::string(2U * level, ' ') /*, kv.second, ") "*/,
+                             kv.first);
             debugNodePrint(&nodes[kv.second], level + 1);
         }
     }
@@ -498,7 +500,7 @@
         FindRoute route;
         if (index >= perMethods.size())
         {
-            BMCWEB_LOG_CRITICAL << "Bad index???";
+            BMCWEB_LOG_CRITICAL("Bad index???");
             return route;
         }
         const PerMethod& perMethod = perMethods[index];
@@ -574,8 +576,7 @@
         unsigned ruleIndex = found.first;
         if (ruleIndex == 0U)
         {
-            BMCWEB_LOG_DEBUG << "Cannot match rules "
-                             << req.url().encoded_path();
+            BMCWEB_LOG_DEBUG("Cannot match rules {}", req.url().encoded_path());
             asyncResp->res.result(boost::beast::http::status::not_found);
             return;
         }
@@ -589,16 +590,16 @@
         size_t methods = rule.getMethods();
         if ((methods & (1U << static_cast<size_t>(*verb))) == 0)
         {
-            BMCWEB_LOG_DEBUG
-                << "Rule found but method mismatch: "
-                << req.url().encoded_path() << " with " << req.methodString()
-                << "(" << static_cast<uint32_t>(*verb) << ") / " << methods;
+            BMCWEB_LOG_DEBUG(
+                "Rule found but method mismatch: {} with {}({}) / {}",
+                req.url().encoded_path(), req.methodString(),
+                static_cast<uint32_t>(*verb), methods);
             asyncResp->res.result(boost::beast::http::status::not_found);
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "Matched rule (upgrade) '" << rule.rule << "' "
-                         << static_cast<uint32_t>(*verb) << " / " << methods;
+        BMCWEB_LOG_DEBUG("Matched rule (upgrade) '{}' {} / {}", rule.rule,
+                         static_cast<uint32_t>(*verb), methods);
 
         // TODO(ed) This should be able to use std::bind_front, but it doesn't
         // appear to work with the std::move on adaptor.
@@ -665,9 +666,8 @@
         BaseRule& rule = *foundRoute.route.rule;
         std::vector<std::string> params = std::move(foundRoute.route.params);
 
-        BMCWEB_LOG_DEBUG << "Matched rule '" << rule.rule << "' "
-                         << static_cast<uint32_t>(*verb) << " / "
-                         << rule.getMethods();
+        BMCWEB_LOG_DEBUG("Matched rule '{}' {} / {}", rule.rule,
+                         static_cast<uint32_t>(*verb), rule.getMethods());
 
         if (req.session == nullptr)
         {
@@ -684,8 +684,9 @@
     {
         for (size_t i = 0; i < perMethods.size(); i++)
         {
-            BMCWEB_LOG_DEBUG << boost::beast::http::to_string(
-                static_cast<boost::beast::http::verb>(i));
+            BMCWEB_LOG_DEBUG("{}",
+                             boost::beast::http::to_string(
+                                 static_cast<boost::beast::http::verb>(i)));
             perMethods[i].trie.debugPrint();
         }
     }
diff --git a/http/routing/websocketrule.hpp b/http/routing/websocketrule.hpp
index c8f706d..5e558f2 100644
--- a/http/routing/websocketrule.hpp
+++ b/http/routing/websocketrule.hpp
@@ -32,7 +32,7 @@
                        const std::shared_ptr<bmcweb::AsyncResp>& /*asyncResp*/,
                        boost::asio::ip::tcp::socket&& adaptor) override
     {
-        BMCWEB_LOG_DEBUG << "Websocket handles upgrade";
+        BMCWEB_LOG_DEBUG("Websocket handles upgrade");
         std::shared_ptr<
             crow::websocket::ConnectionImpl<boost::asio::ip::tcp::socket>>
             myConnection = std::make_shared<
@@ -47,7 +47,7 @@
                        boost::beast::ssl_stream<boost::asio::ip::tcp::socket>&&
                            adaptor) override
     {
-        BMCWEB_LOG_DEBUG << "Websocket handles upgrade";
+        BMCWEB_LOG_DEBUG("Websocket handles upgrade");
         std::shared_ptr<crow::websocket::ConnectionImpl<
             boost::beast::ssl_stream<boost::asio::ip::tcp::socket>>>
             myConnection = std::make_shared<crow::websocket::ConnectionImpl<
diff --git a/http/server_sent_event.hpp b/http/server_sent_event.hpp
index 02af0b7..7733948 100644
--- a/http/server_sent_event.hpp
+++ b/http/server_sent_event.hpp
@@ -49,7 +49,7 @@
         timer(ioc), openHandler(std::move(openHandlerIn)),
         closeHandler(std::move(closeHandlerIn))
     {
-        BMCWEB_LOG_DEBUG << "SseConnectionImpl: SSE constructor " << this;
+        BMCWEB_LOG_DEBUG("SseConnectionImpl: SSE constructor {}", logPtr(this));
     }
 
     ConnectionImpl(const ConnectionImpl&) = delete;
@@ -59,7 +59,7 @@
 
     ~ConnectionImpl() override
     {
-        BMCWEB_LOG_DEBUG << "SSE ConnectionImpl: SSE destructor " << this;
+        BMCWEB_LOG_DEBUG("SSE ConnectionImpl: SSE destructor {}", logPtr(this));
     }
 
     boost::asio::io_context& getIoContext() override
@@ -72,7 +72,7 @@
     {
         if (!openHandler)
         {
-            BMCWEB_LOG_CRITICAL << "No open handler???";
+            BMCWEB_LOG_CRITICAL("No open handler???");
             return;
         }
         openHandler(*this);
@@ -85,13 +85,13 @@
         {
             closeHandler(*this);
         }
-        BMCWEB_LOG_DEBUG << "Closing SSE connection " << this << " - " << msg;
+        BMCWEB_LOG_DEBUG("Closing SSE connection {} - {}", logPtr(this), msg);
         boost::beast::get_lowest_layer(adaptor).close();
     }
 
     void sendSSEHeader()
     {
-        BMCWEB_LOG_DEBUG << "Starting SSE connection";
+        BMCWEB_LOG_DEBUG("Starting SSE connection");
         using BodyType = boost::beast::http::buffer_body;
         boost::beast::http::response<BodyType> res(
             boost::beast::http::status::ok, 11, BodyType{});
@@ -113,11 +113,11 @@
         serializer.reset();
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "Error sending header" << ec;
+            BMCWEB_LOG_ERROR("Error sending header{}", ec);
             close("async_write_header failed");
             return;
         }
-        BMCWEB_LOG_DEBUG << "SSE header sent - Connection established";
+        BMCWEB_LOG_DEBUG("SSE header sent - Connection established");
 
         serializer.reset();
 
@@ -138,7 +138,7 @@
         }
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "Read error: " << ec;
+            BMCWEB_LOG_ERROR("Read error: {}", ec);
         }
 
         close("Close SSE connection");
@@ -152,7 +152,7 @@
         }
         if (inputBuffer.size() == 0)
         {
-            BMCWEB_LOG_DEBUG << "inputBuffer is empty... Bailing out";
+            BMCWEB_LOG_DEBUG("inputBuffer is empty... Bailing out");
             return;
         }
         startTimeout();
@@ -179,19 +179,19 @@
 
         if (ec == boost::asio::error::eof)
         {
-            BMCWEB_LOG_ERROR << "async_write_some() SSE stream closed";
+            BMCWEB_LOG_ERROR("async_write_some() SSE stream closed");
             close("SSE stream closed");
             return;
         }
 
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "async_write_some() failed: " << ec.message();
+            BMCWEB_LOG_ERROR("async_write_some() failed: {}", ec.message());
             close("async_write_some failed");
             return;
         }
-        BMCWEB_LOG_DEBUG << "async_write_some() bytes transferred: "
-                         << bytesTransferred;
+        BMCWEB_LOG_DEBUG("async_write_some() bytes transferred: {}",
+                         bytesTransferred);
 
         doWrite();
     }
@@ -200,7 +200,7 @@
     {
         if (msg.empty())
         {
-            BMCWEB_LOG_DEBUG << "Empty data, bailing out.";
+            BMCWEB_LOG_DEBUG("Empty data, bailing out.");
             return;
         }
 
@@ -249,22 +249,24 @@
         std::shared_ptr<Connection> self = weakSelf.lock();
         if (!self)
         {
-            BMCWEB_LOG_CRITICAL << self << " Failed to capture connection";
+            BMCWEB_LOG_CRITICAL("{} Failed to capture connection",
+                                logPtr(self.get()));
             return;
         }
 
         if (ec == boost::asio::error::operation_aborted)
         {
-            BMCWEB_LOG_DEBUG << "operation aborted";
+            BMCWEB_LOG_DEBUG("operation aborted");
             // Canceled wait means the path succeeeded.
             return;
         }
         if (ec)
         {
-            BMCWEB_LOG_CRITICAL << self << " timer failed " << ec;
+            BMCWEB_LOG_CRITICAL("{} timer failed {}", logPtr(self.get()), ec);
         }
 
-        BMCWEB_LOG_WARNING << self << "Connection timed out, closing";
+        BMCWEB_LOG_WARNING("{}Connection timed out, closing",
+                           logPtr(self.get()));
 
         self->close("closing connection");
     }
diff --git a/http/websocket.hpp b/http/websocket.hpp
index 434a0c1..216c413 100644
--- a/http/websocket.hpp
+++ b/http/websocket.hpp
@@ -75,7 +75,7 @@
         /* Turn on the timeouts on websocket stream to server role */
         ws.set_option(boost::beast::websocket::stream_base::timeout::suggested(
             boost::beast::role_type::server));
-        BMCWEB_LOG_DEBUG << "Creating new connection " << this;
+        BMCWEB_LOG_DEBUG("Creating new connection {}", logPtr(this));
     }
 
     boost::asio::io_context& getIoContext() override
@@ -86,7 +86,7 @@
 
     void start()
     {
-        BMCWEB_LOG_DEBUG << "starting connection " << this;
+        BMCWEB_LOG_DEBUG("starting connection {}", logPtr(this));
 
         using bf = boost::beast::http::field;
 
@@ -104,7 +104,7 @@
                     !crow::utility::constantTimeStringCompare(
                         protocol, session->csrfToken))
                 {
-                    BMCWEB_LOG_ERROR << "Websocket CSRF error";
+                    BMCWEB_LOG_ERROR("Websocket CSRF error");
                     m.result(boost::beast::http::status::unauthorized);
                     return;
                 }
@@ -131,7 +131,7 @@
                                  const boost::system::error_code& ec) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "Error in ws.async_accept " << ec;
+                BMCWEB_LOG_ERROR("Error in ws.async_accept {}", ec);
                 return;
             }
             acceptDone();
@@ -151,8 +151,8 @@
     {
         if (doingWrite)
         {
-            BMCWEB_LOG_CRITICAL
-                << "Cannot mix sendEx usage with sendBinary or sendText";
+            BMCWEB_LOG_CRITICAL(
+                "Cannot mix sendEx usage with sendBinary or sendText");
             onDone();
             return;
         }
@@ -169,7 +169,7 @@
 
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "Error in ws.async_write " << ec;
+                BMCWEB_LOG_ERROR("Error in ws.async_write {}", ec);
                 self->close("write error");
             }
         });
@@ -210,7 +210,7 @@
             }
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "Error closing websocket " << ec;
+                BMCWEB_LOG_ERROR("Error closing websocket {}", ec);
                 return;
             }
             });
@@ -223,7 +223,7 @@
 
     void acceptDone()
     {
-        BMCWEB_LOG_DEBUG << "Websocket accepted connection";
+        BMCWEB_LOG_DEBUG("Websocket accepted connection");
 
         if (openHandler)
         {
@@ -264,7 +264,7 @@
             {
                 if (ec != boost::beast::websocket::error::closed)
                 {
-                    BMCWEB_LOG_ERROR << "doRead error " << ec;
+                    BMCWEB_LOG_ERROR("doRead error {}", ec);
                 }
                 if (closeHandler)
                 {
@@ -306,7 +306,7 @@
             }
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "Error in ws.async_write " << ec;
+                BMCWEB_LOG_ERROR("Error in ws.async_write {}", ec);
                 return;
             }
             doWrite();
diff --git a/include/async_resolve.hpp b/include/async_resolve.hpp
index 2bf5112..3f31e13 100644
--- a/include/async_resolve.hpp
+++ b/include/async_resolve.hpp
@@ -20,14 +20,14 @@
 {
     if (ipAddress.size() == 4) // ipv4 address
     {
-        BMCWEB_LOG_DEBUG << "ipv4 address";
+        BMCWEB_LOG_DEBUG("ipv4 address");
         boost::asio::ip::address_v4 ipv4Addr(
             {ipAddress[0], ipAddress[1], ipAddress[2], ipAddress[3]});
         endpoint.address(ipv4Addr);
     }
     else if (ipAddress.size() == 16) // ipv6 address
     {
-        BMCWEB_LOG_DEBUG << "ipv6 address";
+        BMCWEB_LOG_DEBUG("ipv6 address");
         boost::asio::ip::address_v6 ipv6Addr(
             {ipAddress[0], ipAddress[1], ipAddress[2], ipAddress[3],
              ipAddress[4], ipAddress[5], ipAddress[6], ipAddress[7],
@@ -37,7 +37,7 @@
     }
     else
     {
-        BMCWEB_LOG_ERROR << "Resolve failed to fetch the IP address";
+        BMCWEB_LOG_ERROR("Resolve failed to fetch the IP address");
         return false;
     }
     return true;
@@ -66,14 +66,14 @@
     void async_resolve(const std::string& host, std::string_view port,
                        ResolveHandler&& handler)
     {
-        BMCWEB_LOG_DEBUG << "Trying to resolve: " << host << ":" << port;
+        BMCWEB_LOG_DEBUG("Trying to resolve: {}:{}", host, port);
 
         uint16_t portNum = 0;
 
         auto it = std::from_chars(&*port.begin(), &*port.end(), portNum);
         if (it.ec != std::errc())
         {
-            BMCWEB_LOG_ERROR << "Failed to get the Port";
+            BMCWEB_LOG_ERROR("Failed to get the Port");
             handler(std::make_error_code(std::errc::invalid_argument),
                     results_type{});
 
@@ -90,12 +90,12 @@
             results_type endpointList;
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "Resolve failed: " << ec.message();
+                BMCWEB_LOG_ERROR("Resolve failed: {}", ec.message());
                 handler(ec, endpointList);
                 return;
             }
-            BMCWEB_LOG_DEBUG << "ResolveHostname returned: " << hostName << ":"
-                             << flagNum;
+            BMCWEB_LOG_DEBUG("ResolveHostname returned: {}:{}", hostName,
+                             flagNum);
             // Extract the IP address from the response
             for (const std::tuple<int32_t, int32_t, std::vector<uint8_t>>&
                      resolveList : resp)
@@ -109,7 +109,8 @@
                         boost::system::errc::address_not_available);
                     handler(ecErr, endpointList);
                 }
-                BMCWEB_LOG_DEBUG << "resolved endpoint is : " << endpoint;
+                BMCWEB_LOG_DEBUG("resolved endpoint is : {}",
+                                 endpoint.address().to_string());
                 endpointList.push_back(endpoint);
             }
             // All the resolved data is filled in the endpointList
diff --git a/include/authentication.hpp b/include/authentication.hpp
index 9e3405b..f3246c0 100644
--- a/include/authentication.hpp
+++ b/include/authentication.hpp
@@ -38,7 +38,7 @@
     performBasicAuth(const boost::asio::ip::address& clientIp,
                      std::string_view authHeader)
 {
-    BMCWEB_LOG_DEBUG << "[AuthMiddleware] Basic authentication";
+    BMCWEB_LOG_DEBUG("[AuthMiddleware] Basic authentication");
 
     if (!authHeader.starts_with("Basic "))
     {
@@ -66,9 +66,9 @@
     }
     std::string pass = authData.substr(separator);
 
-    BMCWEB_LOG_DEBUG << "[AuthMiddleware] Authenticating user: " << user;
-    BMCWEB_LOG_DEBUG << "[AuthMiddleware] User IPAddress: "
-                     << clientIp.to_string();
+    BMCWEB_LOG_DEBUG("[AuthMiddleware] Authenticating user: {}", user);
+    BMCWEB_LOG_DEBUG("[AuthMiddleware] User IPAddress: {}",
+                     clientIp.to_string());
 
     int pamrc = pamAuthenticateUser(user, pass);
     bool isConfigureSelfOnly = pamrc == PAM_NEW_AUTHTOK_REQD;
@@ -93,7 +93,7 @@
 static std::shared_ptr<persistent_data::UserSession>
     performTokenAuth(std::string_view authHeader)
 {
-    BMCWEB_LOG_DEBUG << "[AuthMiddleware] Token authentication";
+    BMCWEB_LOG_DEBUG("[AuthMiddleware] Token authentication");
     if (!authHeader.starts_with("Token "))
     {
         return nullptr;
@@ -109,7 +109,7 @@
 static std::shared_ptr<persistent_data::UserSession>
     performXtokenAuth(const boost::beast::http::header<true>& reqHeader)
 {
-    BMCWEB_LOG_DEBUG << "[AuthMiddleware] X-Auth-Token authentication";
+    BMCWEB_LOG_DEBUG("[AuthMiddleware] X-Auth-Token authentication");
 
     std::string_view token = reqHeader["X-Auth-Token"];
     if (token.empty())
@@ -127,7 +127,7 @@
     performCookieAuth(boost::beast::http::verb method [[maybe_unused]],
                       const boost::beast::http::header<true>& reqHeader)
 {
-    BMCWEB_LOG_DEBUG << "[AuthMiddleware] Cookie authentication";
+    BMCWEB_LOG_DEBUG("[AuthMiddleware] Cookie authentication");
 
     std::string_view cookieValue = reqHeader["Cookie"];
     if (cookieValue.empty())
@@ -195,8 +195,8 @@
         // set cookie only if this is req from the browser.
         if (reqHeader["User-Agent"].empty())
         {
-            BMCWEB_LOG_DEBUG << " TLS session: " << sp->uniqueId
-                             << " will be used for this request.";
+            BMCWEB_LOG_DEBUG(" TLS session: {} will be used for this request.",
+                             sp->uniqueId);
             return sp;
         }
         // TODO: change this to not switch to cookie auth
@@ -208,8 +208,9 @@
                           "; SameSite=Strict; Secure; HttpOnly");
         res.addHeader(boost::beast::http::field::set_cookie,
                       "IsAuthenticated=true; Secure");
-        BMCWEB_LOG_DEBUG << " TLS session: " << sp->uniqueId
-                         << " with cookie will be used for this request.";
+        BMCWEB_LOG_DEBUG(
+            " TLS session: {} with cookie will be used for this request.",
+            sp->uniqueId);
         return sp;
     }
     return nullptr;
@@ -284,7 +285,7 @@
     }
 #endif
     std::string_view authHeader = reqHeader["Authorization"];
-    BMCWEB_LOG_DEBUG << "authHeader=" << authHeader;
+    BMCWEB_LOG_DEBUG("authHeader={}", authHeader);
 
     if (sessionOut == nullptr && authMethodsConfig.sessionToken)
     {
diff --git a/include/dbus_monitor.hpp b/include/dbus_monitor.hpp
index 4ecc436..2682717 100644
--- a/include/dbus_monitor.hpp
+++ b/include/dbus_monitor.hpp
@@ -36,7 +36,7 @@
 {
     if (retError == nullptr || (sd_bus_error_is_set(retError) != 0))
     {
-        BMCWEB_LOG_ERROR << "Got sdbus error on match";
+        BMCWEB_LOG_ERROR("Got sdbus error on match");
         return 0;
     }
     crow::websocket::Connection* connection =
@@ -44,7 +44,8 @@
     auto thisSession = sessions.find(connection);
     if (thisSession == sessions.end())
     {
-        BMCWEB_LOG_ERROR << "Couldn't find dbus connection " << connection;
+        BMCWEB_LOG_ERROR("Couldn't find dbus connection {}",
+                         logPtr(connection));
         return 0;
     }
     sdbusplus::message_t message(m);
@@ -57,12 +58,12 @@
         int r = openbmc_mapper::convertDBusToJSON("sa{sv}as", message, data);
         if (r < 0)
         {
-            BMCWEB_LOG_ERROR << "convertDBusToJSON failed with " << r;
+            BMCWEB_LOG_ERROR("convertDBusToJSON failed with {}", r);
             return 0;
         }
         if (!data.is_array())
         {
-            BMCWEB_LOG_ERROR << "No data in PropertiesChanged signal";
+            BMCWEB_LOG_ERROR("No data in PropertiesChanged signal");
             return 0;
         }
 
@@ -76,13 +77,13 @@
         int r = openbmc_mapper::convertDBusToJSON("oa{sa{sv}}", message, data);
         if (r < 0)
         {
-            BMCWEB_LOG_ERROR << "convertDBusToJSON failed with " << r;
+            BMCWEB_LOG_ERROR("convertDBusToJSON failed with {}", r);
             return 0;
         }
 
         if (!data.is_array())
         {
-            BMCWEB_LOG_ERROR << "No data in InterfacesAdded signal";
+            BMCWEB_LOG_ERROR("No data in InterfacesAdded signal");
             return 0;
         }
 
@@ -98,8 +99,7 @@
     }
     else
     {
-        BMCWEB_LOG_CRITICAL << "message " << message.get_member()
-                            << " was unexpected";
+        BMCWEB_LOG_CRITICAL("message {} was unexpected", message.get_member());
         return 0;
     }
 
@@ -114,140 +114,140 @@
         .privileges({{"Login"}})
         .websocket()
         .onopen([&](crow::websocket::Connection& conn) {
-            BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened";
+            BMCWEB_LOG_DEBUG("Connection {} opened", logPtr(&conn));
             sessions.try_emplace(&conn);
         })
         .onclose([&](crow::websocket::Connection& conn, const std::string&) {
             sessions.erase(&conn);
         })
-        .onmessage(
-            [&](crow::websocket::Connection& conn, const std::string& data,
-                bool) {
-        const auto sessionPair = sessions.find(&conn);
-        if (sessionPair == sessions.end())
-        {
-            conn.close("Internal error");
-        }
-        DbusWebsocketSession& thisSession = sessionPair->second;
-        BMCWEB_LOG_DEBUG << "Connection " << &conn << " received " << data;
-        nlohmann::json j = nlohmann::json::parse(data, nullptr, false);
-        if (j.is_discarded())
-        {
-            BMCWEB_LOG_ERROR << "Unable to parse json data for monitor";
-            conn.close("Unable to parse json request");
-            return;
-        }
-        nlohmann::json::iterator interfaces = j.find("interfaces");
-        if (interfaces != j.end())
-        {
-            thisSession.interfaces.reserve(interfaces->size());
-            for (auto& interface : *interfaces)
+        .onmessage([&](crow::websocket::Connection& conn,
+                       const std::string& data, bool) {
+            const auto sessionPair = sessions.find(&conn);
+            if (sessionPair == sessions.end())
             {
-                const std::string* str =
-                    interface.get_ptr<const std::string*>();
-                if (str != nullptr)
+                conn.close("Internal error");
+            }
+            DbusWebsocketSession& thisSession = sessionPair->second;
+            BMCWEB_LOG_DEBUG("Connection {} received {}", logPtr(&conn), data);
+            nlohmann::json j = nlohmann::json::parse(data, nullptr, false);
+            if (j.is_discarded())
+            {
+                BMCWEB_LOG_ERROR("Unable to parse json data for monitor");
+                conn.close("Unable to parse json request");
+                return;
+            }
+            nlohmann::json::iterator interfaces = j.find("interfaces");
+            if (interfaces != j.end())
+            {
+                thisSession.interfaces.reserve(interfaces->size());
+                for (auto& interface : *interfaces)
                 {
-                    thisSession.interfaces.insert(*str);
+                    const std::string* str =
+                        interface.get_ptr<const std::string*>();
+                    if (str != nullptr)
+                    {
+                        thisSession.interfaces.insert(*str);
+                    }
                 }
             }
-        }
 
-        nlohmann::json::iterator paths = j.find("paths");
-        if (paths == j.end())
-        {
-            BMCWEB_LOG_ERROR << "Unable to find paths in json data";
-            conn.close("Unable to find paths in json data");
-            return;
-        }
-
-        size_t interfaceCount = thisSession.interfaces.size();
-        if (interfaceCount == 0)
-        {
-            interfaceCount = 1;
-        }
-        // Reserve our matches upfront.  For each path there is 1 for
-        // interfacesAdded, and InterfaceCount number for
-        // PropertiesChanged
-        thisSession.matches.reserve(thisSession.matches.size() +
-                                    paths->size() * (1U + interfaceCount));
-
-        // These regexes derived on the rules here:
-        // https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names
-        static std::regex validPath("^/([A-Za-z0-9_]+/?)*$");
-        static std::regex validInterface(
-            "^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)+$");
-
-        for (const auto& thisPath : *paths)
-        {
-            const std::string* thisPathString =
-                thisPath.get_ptr<const std::string*>();
-            if (thisPathString == nullptr)
+            nlohmann::json::iterator paths = j.find("paths");
+            if (paths == j.end())
             {
-                BMCWEB_LOG_ERROR << "subscribe path isn't a string?";
-                conn.close();
+                BMCWEB_LOG_ERROR("Unable to find paths in json data");
+                conn.close("Unable to find paths in json data");
                 return;
             }
-            if (!std::regex_match(*thisPathString, validPath))
-            {
-                BMCWEB_LOG_ERROR << "Invalid path name " << *thisPathString;
-                conn.close();
-                return;
-            }
-            std::string propertiesMatchString =
-                ("type='signal',"
-                 "interface='org.freedesktop.DBus.Properties',"
-                 "path_namespace='" +
-                 *thisPathString +
-                 "',"
-                 "member='PropertiesChanged'");
-            // If interfaces weren't specified, add a single match for all
-            // interfaces
-            if (thisSession.interfaces.empty())
-            {
-                BMCWEB_LOG_DEBUG << "Creating match " << propertiesMatchString;
 
-                thisSession.matches.emplace_back(
-                    std::make_unique<sdbusplus::bus::match_t>(
-                        *crow::connections::systemBus, propertiesMatchString,
-                        onPropertyUpdate, &conn));
-            }
-            else
+            size_t interfaceCount = thisSession.interfaces.size();
+            if (interfaceCount == 0)
             {
-                // If interfaces were specified, add a match for each
-                // interface
-                for (const std::string& interface : thisSession.interfaces)
+                interfaceCount = 1;
+            }
+            // Reserve our matches upfront.  For each path there is 1 for
+            // interfacesAdded, and InterfaceCount number for
+            // PropertiesChanged
+            thisSession.matches.reserve(thisSession.matches.size() +
+                                        paths->size() * (1U + interfaceCount));
+
+            // These regexes derived on the rules here:
+            // https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names
+            static std::regex validPath("^/([A-Za-z0-9_]+/?)*$");
+            static std::regex validInterface(
+                "^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)+$");
+
+            for (const auto& thisPath : *paths)
+            {
+                const std::string* thisPathString =
+                    thisPath.get_ptr<const std::string*>();
+                if (thisPathString == nullptr)
                 {
-                    if (!std::regex_match(interface, validInterface))
-                    {
-                        BMCWEB_LOG_ERROR << "Invalid interface name "
-                                         << interface;
-                        conn.close();
-                        return;
-                    }
-                    std::string ifaceMatchString = propertiesMatchString;
-                    ifaceMatchString += ",arg0='";
-                    ifaceMatchString += interface;
-                    ifaceMatchString += "'";
-                    BMCWEB_LOG_DEBUG << "Creating match " << ifaceMatchString;
+                    BMCWEB_LOG_ERROR("subscribe path isn't a string?");
+                    conn.close();
+                    return;
+                }
+                if (!std::regex_match(*thisPathString, validPath))
+                {
+                    BMCWEB_LOG_ERROR("Invalid path name {}", *thisPathString);
+                    conn.close();
+                    return;
+                }
+                std::string propertiesMatchString =
+                    ("type='signal',"
+                     "interface='org.freedesktop.DBus.Properties',"
+                     "path_namespace='" +
+                     *thisPathString +
+                     "',"
+                     "member='PropertiesChanged'");
+                // If interfaces weren't specified, add a single match for all
+                // interfaces
+                if (thisSession.interfaces.empty())
+                {
+                    BMCWEB_LOG_DEBUG("Creating match {}",
+                                     propertiesMatchString);
+
                     thisSession.matches.emplace_back(
                         std::make_unique<sdbusplus::bus::match_t>(
-                            *crow::connections::systemBus, ifaceMatchString,
-                            onPropertyUpdate, &conn));
+                            *crow::connections::systemBus,
+                            propertiesMatchString, onPropertyUpdate, &conn));
                 }
+                else
+                {
+                    // If interfaces were specified, add a match for each
+                    // interface
+                    for (const std::string& interface : thisSession.interfaces)
+                    {
+                        if (!std::regex_match(interface, validInterface))
+                        {
+                            BMCWEB_LOG_ERROR("Invalid interface name {}",
+                                             interface);
+                            conn.close();
+                            return;
+                        }
+                        std::string ifaceMatchString = propertiesMatchString;
+                        ifaceMatchString += ",arg0='";
+                        ifaceMatchString += interface;
+                        ifaceMatchString += "'";
+                        BMCWEB_LOG_DEBUG("Creating match {}", ifaceMatchString);
+                        thisSession.matches.emplace_back(
+                            std::make_unique<sdbusplus::bus::match_t>(
+                                *crow::connections::systemBus, ifaceMatchString,
+                                onPropertyUpdate, &conn));
+                    }
+                }
+                std::string objectManagerMatchString =
+                    ("type='signal',"
+                     "interface='org.freedesktop.DBus.ObjectManager',"
+                     "path_namespace='" +
+                     *thisPathString +
+                     "',"
+                     "member='InterfacesAdded'");
+                BMCWEB_LOG_DEBUG("Creating match {}", objectManagerMatchString);
+                thisSession.matches.emplace_back(
+                    std::make_unique<sdbusplus::bus::match_t>(
+                        *crow::connections::systemBus, objectManagerMatchString,
+                        onPropertyUpdate, &conn));
             }
-            std::string objectManagerMatchString =
-                ("type='signal',"
-                 "interface='org.freedesktop.DBus.ObjectManager',"
-                 "path_namespace='" +
-                 *thisPathString +
-                 "',"
-                 "member='InterfacesAdded'");
-            BMCWEB_LOG_DEBUG << "Creating match " << objectManagerMatchString;
-            thisSession.matches.emplace_back(
-                std::make_unique<sdbusplus::bus::match_t>(
-                    *crow::connections::systemBus, objectManagerMatchString,
-                    onPropertyUpdate, &conn));
-        }
         });
 }
 } // namespace dbus_monitor
diff --git a/include/dbus_privileges.hpp b/include/dbus_privileges.hpp
index 377a41c..65b4042 100644
--- a/include/dbus_privileges.hpp
+++ b/include/dbus_privileges.hpp
@@ -34,7 +34,7 @@
 
     if (!success)
     {
-        BMCWEB_LOG_ERROR << "Failed to unpack user properties.";
+        BMCWEB_LOG_ERROR("Failed to unpack user properties.");
         asyncResp->res.result(
             boost::beast::http::status::internal_server_error);
         return false;
@@ -43,13 +43,13 @@
     if (userRolePtr != nullptr)
     {
         req.session->userRole = *userRolePtr;
-        BMCWEB_LOG_DEBUG << "userName = " << req.session->username
-                         << " userRole = " << *userRolePtr;
+        BMCWEB_LOG_DEBUG("userName = {} userRole = {}", req.session->username,
+                         *userRolePtr);
     }
 
     if (remoteUser == nullptr)
     {
-        BMCWEB_LOG_ERROR << "RemoteUser property missing or wrong type";
+        BMCWEB_LOG_ERROR("RemoteUser property missing or wrong type");
         asyncResp->res.result(
             boost::beast::http::status::internal_server_error);
         return false;
@@ -59,8 +59,8 @@
     {
         if (!*remoteUser)
         {
-            BMCWEB_LOG_ERROR << "UserPasswordExpired property is expected for"
-                                " local user but is missing or wrong type";
+            BMCWEB_LOG_ERROR("UserPasswordExpired property is expected for"
+                             " local user but is missing or wrong type");
             asyncResp->res.result(
                 boost::beast::http::status::internal_server_error);
             return false;
@@ -103,7 +103,7 @@
         // Remove all privileges except ConfigureSelf
         userPrivileges =
             userPrivileges.intersection(redfish::Privileges{"ConfigureSelf"});
-        BMCWEB_LOG_DEBUG << "Operation limited to ConfigureSelf";
+        BMCWEB_LOG_DEBUG("Operation limited to ConfigureSelf");
     }
 
     if (!rule.checkPrivileges(userPrivileges))
@@ -132,7 +132,7 @@
 {
     if (ec)
     {
-        BMCWEB_LOG_ERROR << "GetUserInfo failed...";
+        BMCWEB_LOG_ERROR("GetUserInfo failed...");
         asyncResp->res.result(
             boost::beast::http::status::internal_server_error);
         return;
@@ -140,7 +140,7 @@
 
     if (!populateUserInfo(req, asyncResp, userInfoMap))
     {
-        BMCWEB_LOG_ERROR << "Failed to populate user information";
+        BMCWEB_LOG_ERROR("Failed to populate user information");
         asyncResp->res.result(
             boost::beast::http::status::internal_server_error);
         return;
@@ -149,7 +149,7 @@
     if (!isUserPrivileged(req, asyncResp, rule))
     {
         // User is not privileged
-        BMCWEB_LOG_ERROR << "Insufficient Privilege";
+        BMCWEB_LOG_ERROR("Insufficient Privilege");
         asyncResp->res.result(boost::beast::http::status::forbidden);
         return;
     }
diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp
index f8e53f4..948b8f0 100644
--- a/include/dbus_utility.hpp
+++ b/include/dbus_utility.hpp
@@ -111,7 +111,7 @@
 {
     if (ec)
     {
-        BMCWEB_LOG_ERROR << "DBus error: " << ec << ", cannot call method";
+        BMCWEB_LOG_ERROR("DBus error: {}, cannot call method", ec);
     }
 }
 
diff --git a/include/event_service_store.hpp b/include/event_service_store.hpp
index dcc99f1..61f1ac7 100644
--- a/include/event_service_store.hpp
+++ b/include/event_service_store.hpp
@@ -151,8 +151,8 @@
                         val.value().get_ptr<const std::string*>();
                     if (value == nullptr)
                     {
-                        BMCWEB_LOG_ERROR << "Failed to parse value for key"
-                                         << val.key();
+                        BMCWEB_LOG_ERROR("Failed to parse value for key{}",
+                                         val.key());
                         continue;
                     }
                     subvalue->httpHeaders.set(val.key(), *value);
@@ -174,9 +174,9 @@
             }
             else
             {
-                BMCWEB_LOG_ERROR
-                    << "Got unexpected property reading persistent file: "
-                    << element.key();
+                BMCWEB_LOG_ERROR(
+                    "Got unexpected property reading persistent file: {}",
+                    element.key());
                 continue;
             }
         }
@@ -187,8 +187,8 @@
             subvalue->eventFormatType.empty() ||
             subvalue->subscriptionType.empty())
         {
-            BMCWEB_LOG_ERROR << "Subscription missing required field "
-                                "information, refusing to restore";
+            BMCWEB_LOG_ERROR("Subscription missing required field "
+                             "information, refusing to restore");
             return nullptr;
         }
 
diff --git a/include/google/google_service_root.hpp b/include/google/google_service_root.hpp
index f39b45f..bb51490 100644
--- a/include/google/google_service_root.hpp
+++ b/include/google/google_service_root.hpp
@@ -153,8 +153,8 @@
 {
     if (ec)
     {
-        BMCWEB_LOG_ERROR << "RootOfTrust.Actions.SendCommand failed: "
-                         << ec.message();
+        BMCWEB_LOG_ERROR("RootOfTrust.Actions.SendCommand failed: {}",
+                         ec.message());
         redfish::messages::internalError(asyncResp->res);
         return;
     }
@@ -171,7 +171,7 @@
     std::vector<uint8_t> bytes = hexStringToBytes(command);
     if (bytes.empty())
     {
-        BMCWEB_LOG_DEBUG << "Invalid command: " << command;
+        BMCWEB_LOG_DEBUG("Invalid command: {}", command);
         redfish::messages::actionParameterValueTypeError(command, "Command",
                                                          "SendCommand");
         return;
@@ -195,7 +195,7 @@
     if (!redfish::json_util::readJsonAction(request, asyncResp->res, "Command",
                                             command))
     {
-        BMCWEB_LOG_DEBUG << "Missing property Command.";
+        BMCWEB_LOG_DEBUG("Missing property Command.");
         redfish::messages::actionParameterMissing(asyncResp->res, "SendCommand",
                                                   "Command");
         return;
diff --git a/include/hostname_monitor.hpp b/include/hostname_monitor.hpp
index fd49b02..f1a0d3d 100644
--- a/include/hostname_monitor.hpp
+++ b/include/hostname_monitor.hpp
@@ -22,12 +22,12 @@
         [certPath](const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "Replace Certificate Fail..";
+            BMCWEB_LOG_ERROR("Replace Certificate Fail..");
             return;
         }
 
-        BMCWEB_LOG_INFO << "Replace HTTPs Certificate Success, "
-                           "remove temporary certificate file..";
+        BMCWEB_LOG_INFO("Replace HTTPs Certificate Success, "
+                        "remove temporary certificate file..");
         remove(certPath.c_str());
         },
         "xyz.openbmc_project.Certs.Manager.Server.Https",
@@ -40,7 +40,7 @@
 {
     if (retError == nullptr || (sd_bus_error_is_set(retError) != 0))
     {
-        BMCWEB_LOG_ERROR << "Got sdbus error on match";
+        BMCWEB_LOG_ERROR("Got sdbus error on match");
         return 0;
     }
 
@@ -62,13 +62,13 @@
         return 0;
     }
 
-    BMCWEB_LOG_DEBUG << "Read hostname from signal: " << *hostname;
+    BMCWEB_LOG_DEBUG("Read hostname from signal: {}", *hostname);
     const std::string certFile = "/etc/ssl/certs/https/server.pem";
 
     X509* cert = ensuressl::loadCert(certFile);
     if (cert == nullptr)
     {
-        BMCWEB_LOG_ERROR << "Failed to read cert";
+        BMCWEB_LOG_ERROR("Failed to read cert");
         return 0;
     }
 
@@ -80,7 +80,7 @@
                                              cnBuffer.size());
     if (cnLength == -1)
     {
-        BMCWEB_LOG_ERROR << "Failed to read NID_commonName";
+        BMCWEB_LOG_ERROR("Failed to read NID_commonName");
         X509_free(cert);
         return 0;
     }
@@ -90,16 +90,16 @@
     EVP_PKEY* pPubKey = X509_get_pubkey(cert);
     if (pPubKey == nullptr)
     {
-        BMCWEB_LOG_ERROR << "Failed to get public key";
+        BMCWEB_LOG_ERROR("Failed to get public key");
         X509_free(cert);
         return 0;
     }
     int isSelfSigned = X509_verify(cert, pPubKey);
     EVP_PKEY_free(pPubKey);
 
-    BMCWEB_LOG_DEBUG << "Current HTTPs Certificate Subject CN: " << cnValue
-                     << ", New HostName: " << *hostname
-                     << ", isSelfSigned: " << isSelfSigned;
+    BMCWEB_LOG_DEBUG(
+        "Current HTTPs Certificate Subject CN: {}, New HostName: {}, isSelfSigned: {}",
+        cnValue, *hostname, isSelfSigned);
 
     ASN1_IA5STRING* asn1 = static_cast<ASN1_IA5STRING*>(
         X509_get_ext_d2i(cert, NID_netscape_comment, nullptr, nullptr));
@@ -108,13 +108,14 @@
         // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
         std::string_view comment(reinterpret_cast<const char*>(asn1->data),
                                  static_cast<size_t>(asn1->length));
-        BMCWEB_LOG_DEBUG << "x509Comment: " << comment;
+        BMCWEB_LOG_DEBUG("x509Comment: {}", comment);
 
         if (ensuressl::x509Comment == comment && isSelfSigned == 1 &&
             cnValue != *hostname)
         {
-            BMCWEB_LOG_INFO << "Ready to generate new HTTPs "
-                            << "certificate with subject cn: " << *hostname;
+            BMCWEB_LOG_INFO(
+                "Ready to generate new HTTPs certificate with subject cn: {}",
+                *hostname);
 
             ensuressl::generateSslCertificate("/tmp/hostname_cert.tmp",
                                               *hostname);
@@ -128,7 +129,7 @@
 
 inline void registerHostnameSignal()
 {
-    BMCWEB_LOG_INFO << "Register HostName PropertiesChanged Signal";
+    BMCWEB_LOG_INFO("Register HostName PropertiesChanged Signal");
     std::string propertiesMatchString =
         ("type='signal',"
          "interface='org.freedesktop.DBus.Properties',"
diff --git a/include/ibm/locks.hpp b/include/ibm/locks.hpp
index b61f9a5..2208aaf 100644
--- a/include/ibm/locks.hpp
+++ b/include/ibm/locks.hpp
@@ -200,7 +200,7 @@
                 // given
                 if (std::get<0>(it->second[0]) == i)
                 {
-                    BMCWEB_LOG_DEBUG << "Session id is found in the locktable";
+                    BMCWEB_LOG_DEBUG("Session id is found in the locktable");
 
                     // Push the whole lock record into a vector for returning
                     // the json
@@ -225,7 +225,7 @@
     if (!status)
     {
         // Validation of rids failed
-        BMCWEB_LOG_ERROR << "releaseLock: Contains invalid request id";
+        BMCWEB_LOG_ERROR("releaseLock: Contains invalid request id");
         return std::make_pair(false, status);
     }
     // Validation passed, check if all the locks are owned by the
@@ -247,8 +247,8 @@
         bool status = isValidLockRequest(lockRecord);
         if (!status)
         {
-            BMCWEB_LOG_DEBUG << "Not a Valid record";
-            BMCWEB_LOG_DEBUG << "Bad json in request";
+            BMCWEB_LOG_DEBUG("Not a Valid record");
+            BMCWEB_LOG_DEBUG("Bad json in request");
             return std::make_pair(true, std::make_pair(status, 0));
         }
     }
@@ -259,16 +259,16 @@
 
     if (status)
     {
-        BMCWEB_LOG_DEBUG << "There is a conflict within itself";
+        BMCWEB_LOG_DEBUG("There is a conflict within itself");
         return std::make_pair(true, std::make_pair(status, 1));
     }
-    BMCWEB_LOG_DEBUG << "The request is not conflicting within itself";
+    BMCWEB_LOG_DEBUG("The request is not conflicting within itself");
 
     // Need to check for conflict with the locktable entries.
 
     auto conflict = isConflictWithTable(multiRequest);
 
-    BMCWEB_LOG_DEBUG << "Done with checking conflict with the locktable";
+    BMCWEB_LOG_DEBUG("Done with checking conflict with the locktable");
     return std::make_pair(false, conflict);
 }
 
@@ -285,10 +285,10 @@
                 // given
                 if (std::get<0>(it->second[0]) == sessionId)
                 {
-                    BMCWEB_LOG_DEBUG << "Remove the lock from the locktable "
-                                        "having sessionID="
-                                     << sessionId;
-                    BMCWEB_LOG_DEBUG << "TransactionID =" << it->first;
+                    BMCWEB_LOG_DEBUG("Remove the lock from the locktable "
+                                     "having sessionID={}",
+                                     sessionId);
+                    BMCWEB_LOG_DEBUG("TransactionID ={}", it->first);
                     it = lockTable.erase(it);
                 }
                 else
@@ -315,23 +315,23 @@
             (expectedSessionId == ids.second))
         {
             // It is owned by the currently request hmc
-            BMCWEB_LOG_DEBUG << "Lock is owned  by the current hmc";
+            BMCWEB_LOG_DEBUG("Lock is owned  by the current hmc");
             // remove the lock
             if (lockTable.erase(id) != 0U)
             {
-                BMCWEB_LOG_DEBUG << "Removing the locks with transaction ID : "
-                                 << id;
+                BMCWEB_LOG_DEBUG("Removing the locks with transaction ID : {}",
+                                 id);
             }
             else
             {
-                BMCWEB_LOG_ERROR << "Removing the locks from the lock table "
-                                    "failed, transaction ID: "
-                                 << id;
+                BMCWEB_LOG_ERROR("Removing the locks from the lock table "
+                                 "failed, transaction ID: {}",
+                                 id);
             }
         }
         else
         {
-            BMCWEB_LOG_DEBUG << "Lock is not owned by the current hmc";
+            BMCWEB_LOG_DEBUG("Lock is not owned by the current hmc");
             return std::make_pair(false, std::make_pair(id, lockTable[id][0]));
         }
     }
@@ -346,13 +346,13 @@
 
         if (search != lockTable.end())
         {
-            BMCWEB_LOG_DEBUG << "Valid Transaction id";
+            BMCWEB_LOG_DEBUG("Valid Transaction id");
             //  continue for the next rid
         }
         else
         {
-            BMCWEB_LOG_ERROR << "validateRids: At least 1 inValid Request id: "
-                             << id;
+            BMCWEB_LOG_ERROR("validateRids: At least 1 inValid Request id: {}",
+                             id);
             return false;
         }
     }
@@ -366,21 +366,21 @@
     if (!((boost::equals(std::get<2>(refLockRecord), "Read") ||
            (boost::equals(std::get<2>(refLockRecord), "Write")))))
     {
-        BMCWEB_LOG_DEBUG << "Validation of LockType Failed";
-        BMCWEB_LOG_DEBUG << "Locktype : " << std::get<2>(refLockRecord);
+        BMCWEB_LOG_DEBUG("Validation of LockType Failed");
+        BMCWEB_LOG_DEBUG("Locktype : {}", std::get<2>(refLockRecord));
         return false;
     }
 
-    BMCWEB_LOG_DEBUG << static_cast<int>(std::get<4>(refLockRecord).size());
+    BMCWEB_LOG_DEBUG("{}", static_cast<int>(std::get<4>(refLockRecord).size()));
 
     // validate the number of segments
     // Allowed No of segments are between 2 and 6
     if ((static_cast<int>(std::get<4>(refLockRecord).size()) > 6) ||
         (static_cast<int>(std::get<4>(refLockRecord).size()) < 2))
     {
-        BMCWEB_LOG_DEBUG << "Validation of Number of Segments Failed";
-        BMCWEB_LOG_DEBUG << "Number of Segments provied : "
-                         << std::get<4>(refLockRecord).size();
+        BMCWEB_LOG_DEBUG("Validation of Number of Segments Failed");
+        BMCWEB_LOG_DEBUG("Number of Segments provied : {}",
+                         std::get<4>(refLockRecord).size());
         return false;
     }
 
@@ -396,8 +396,8 @@
                (boost::equals(p.first, "LockAll")) ||
                (boost::equals(p.first, "DontLock")))))
         {
-            BMCWEB_LOG_DEBUG << "Validation of lock flags failed";
-            BMCWEB_LOG_DEBUG << p.first;
+            BMCWEB_LOG_DEBUG("Validation of lock flags failed");
+            BMCWEB_LOG_DEBUG("{}", p.first);
             return false;
         }
 
@@ -406,8 +406,8 @@
 
         if (p.second < 1 || p.second > 4)
         {
-            BMCWEB_LOG_DEBUG << "Validation of Segment Length Failed";
-            BMCWEB_LOG_DEBUG << p.second;
+            BMCWEB_LOG_DEBUG("Validation of Segment Length Failed");
+            BMCWEB_LOG_DEBUG("{}", p.second);
             return false;
         }
 
@@ -430,16 +430,16 @@
     if (lockTable.empty())
     {
         uint32_t thisTransactionId = generateTransactionId();
-        BMCWEB_LOG_DEBUG << thisTransactionId;
+        BMCWEB_LOG_DEBUG("{}", thisTransactionId);
         // Lock table is empty, so we are safe to add the lockrecords
         // as there will be no conflict
-        BMCWEB_LOG_DEBUG << "Lock table is empty, so adding the lockrecords";
+        BMCWEB_LOG_DEBUG("Lock table is empty, so adding the lockrecords");
         lockTable.emplace(thisTransactionId, refLockRequestStructure);
 
         return std::make_pair(false, thisTransactionId);
     }
-    BMCWEB_LOG_DEBUG
-        << "Lock table is not empty, check for conflict with lock table";
+    BMCWEB_LOG_DEBUG(
+        "Lock table is not empty, check for conflict with lock table");
     // Lock table is not empty, compare the lockrequest entries with
     // the entries in the lock table
 
@@ -464,7 +464,7 @@
 
     // Lock table is empty, so we are safe to add the lockrecords
     // as there will be no conflict
-    BMCWEB_LOG_DEBUG << " Adding elements into lock table";
+    BMCWEB_LOG_DEBUG(" Adding elements into lock table");
     transactionId = generateTransactionId();
     lockTable.emplace(std::make_pair(transactionId, refLockRequestStructure));
 
@@ -478,14 +478,14 @@
 
     if (refLockRequestStructure.size() == 1)
     {
-        BMCWEB_LOG_DEBUG << "Only single lock request, so there is no conflict";
+        BMCWEB_LOG_DEBUG("Only single lock request, so there is no conflict");
         // This means , we have only one lock request in the current
         // request , so no conflict within the request
         return false;
     }
 
-    BMCWEB_LOG_DEBUG
-        << "There are multiple lock requests coming in a single request";
+    BMCWEB_LOG_DEBUG(
+        "There are multiple lock requests coming in a single request");
 
     // There are multiple requests a part of one request
 
@@ -537,7 +537,7 @@
     if (boost::equals(std::get<2>(refLockRecord1), "Read") &&
         boost::equals(std::get<2>(refLockRecord2), "Read"))
     {
-        BMCWEB_LOG_DEBUG << "Both are read locks, no conflict";
+        BMCWEB_LOG_DEBUG("Both are read locks, no conflict");
         return false;
     }
 
@@ -549,9 +549,9 @@
         if (boost::equals(p.first, "LockAll") ||
             boost::equals(std::get<4>(refLockRecord2)[i].first, "LockAll"))
         {
-            BMCWEB_LOG_DEBUG
-                << "Either of the Comparing locks are trying to lock all "
-                   "resources under the current resource level";
+            BMCWEB_LOG_DEBUG(
+                "Either of the Comparing locks are trying to lock all "
+                "resources under the current resource level");
             return true;
         }
 
@@ -569,10 +569,10 @@
         // So no conflict
         if (p.second != std::get<4>(refLockRecord2)[i].second)
         {
-            BMCWEB_LOG_DEBUG << "Segment lengths are not same";
-            BMCWEB_LOG_DEBUG << "Segment 1 length : " << p.second;
-            BMCWEB_LOG_DEBUG << "Segment 2 length : "
-                             << std::get<4>(refLockRecord2)[i].second;
+            BMCWEB_LOG_DEBUG("Segment lengths are not same");
+            BMCWEB_LOG_DEBUG("Segment 1 length : {}", p.second);
+            BMCWEB_LOG_DEBUG("Segment 2 length : {}",
+                             std::get<4>(refLockRecord2)[i].second);
             return false;
         }
 
diff --git a/include/ibm/management_console_rest.hpp b/include/ibm/management_console_rest.hpp
index 579d46c..b87cb1e 100644
--- a/include/ibm/management_console_rest.hpp
+++ b/include/ibm/management_console_rest.hpp
@@ -55,11 +55,11 @@
         asyncResp->res.jsonValue["Description"] = contentNotAcceptableMsg;
         return;
     }
-    BMCWEB_LOG_DEBUG
-        << "File upload in application/octet-stream format. Continue..";
+    BMCWEB_LOG_DEBUG(
+        "File upload in application/octet-stream format. Continue..");
 
-    BMCWEB_LOG_DEBUG
-        << "handleIbmPut: Request to create/update the save-area file";
+    BMCWEB_LOG_DEBUG(
+        "handleIbmPut: Request to create/update the save-area file");
     std::string_view path =
         "/var/lib/bmcweb/ibm-management-console/configfiles";
     if (!crow::ibm_utils::createDirectory(path))
@@ -80,9 +80,9 @@
         asyncResp->res.result(
             boost::beast::http::status::internal_server_error);
         asyncResp->res.jsonValue["Description"] = internalServerError;
-        BMCWEB_LOG_DEBUG << "handleIbmPut: Failed to prepare save-area "
-                            "directory iterator. ec : "
-                         << ec;
+        BMCWEB_LOG_DEBUG("handleIbmPut: Failed to prepare save-area "
+                         "directory iterator. ec : {}",
+                         ec.message());
         return;
     }
     std::uintmax_t saveAreaDirSize = 0;
@@ -95,9 +95,9 @@
                 asyncResp->res.result(
                     boost::beast::http::status::internal_server_error);
                 asyncResp->res.jsonValue["Description"] = internalServerError;
-                BMCWEB_LOG_DEBUG << "handleIbmPut: Failed to find save-area "
-                                    "directory . ec : "
-                                 << ec;
+                BMCWEB_LOG_DEBUG("handleIbmPut: Failed to find save-area "
+                                 "directory . ec : {}",
+                                 ec.message());
                 return;
             }
             std::uintmax_t fileSize = std::filesystem::file_size(it, ec);
@@ -106,19 +106,19 @@
                 asyncResp->res.result(
                     boost::beast::http::status::internal_server_error);
                 asyncResp->res.jsonValue["Description"] = internalServerError;
-                BMCWEB_LOG_DEBUG << "handleIbmPut: Failed to find save-area "
-                                    "file size inside the directory . ec : "
-                                 << ec;
+                BMCWEB_LOG_DEBUG("handleIbmPut: Failed to find save-area "
+                                 "file size inside the directory . ec : {}",
+                                 ec.message());
                 return;
             }
             saveAreaDirSize += fileSize;
         }
     }
-    BMCWEB_LOG_DEBUG << "saveAreaDirSize: " << saveAreaDirSize;
+    BMCWEB_LOG_DEBUG("saveAreaDirSize: {}", saveAreaDirSize);
 
     // Get the file size getting uploaded
     const std::string& data = req.body();
-    BMCWEB_LOG_DEBUG << "data length: " << data.length();
+    BMCWEB_LOG_DEBUG("data length: {}", data.length());
 
     if (data.length() < minSaveareaFileSize)
     {
@@ -137,7 +137,7 @@
 
     // Form the file path
     loc /= fileID;
-    BMCWEB_LOG_DEBUG << "Writing to the file: " << loc.string();
+    BMCWEB_LOG_DEBUG("Writing to the file: {}", loc.string());
 
     // Check if the same file exists in the directory
     bool fileExists = std::filesystem::exists(loc, ec);
@@ -146,8 +146,8 @@
         asyncResp->res.result(
             boost::beast::http::status::internal_server_error);
         asyncResp->res.jsonValue["Description"] = internalServerError;
-        BMCWEB_LOG_DEBUG << "handleIbmPut: Failed to find if file exists. ec : "
-                         << ec;
+        BMCWEB_LOG_DEBUG("handleIbmPut: Failed to find if file exists. ec : {}",
+                         ec.message());
         return;
     }
 
@@ -161,8 +161,8 @@
             asyncResp->res.result(
                 boost::beast::http::status::internal_server_error);
             asyncResp->res.jsonValue["Description"] = internalServerError;
-            BMCWEB_LOG_DEBUG << "handleIbmPut: Failed to find file size. ec : "
-                             << ec;
+            BMCWEB_LOG_DEBUG("handleIbmPut: Failed to find file size. ec : {}",
+                             ec.message());
             return;
         }
         // Calculate the difference in the file size.
@@ -175,7 +175,7 @@
         {
             newSizeToWrite = data.length() - currentFileSize;
         }
-        BMCWEB_LOG_DEBUG << "newSizeToWrite: " << newSizeToWrite;
+        BMCWEB_LOG_DEBUG("newSizeToWrite: {}", newSizeToWrite);
     }
     else
     {
@@ -184,7 +184,7 @@
     }
 
     // Calculate the total dir size before writing the new file
-    BMCWEB_LOG_DEBUG << "total new size: " << saveAreaDirSize + newSizeToWrite;
+    BMCWEB_LOG_DEBUG("total new size: {}", saveAreaDirSize + newSizeToWrite);
 
     if ((saveAreaDirSize + newSizeToWrite) > maxSaveareaDirSize)
     {
@@ -204,7 +204,7 @@
 
     if (file.fail())
     {
-        BMCWEB_LOG_DEBUG << "Error while opening the file for writing";
+        BMCWEB_LOG_DEBUG("Error while opening the file for writing");
         asyncResp->res.result(
             boost::beast::http::status::internal_server_error);
         asyncResp->res.jsonValue["Description"] =
@@ -217,12 +217,12 @@
     // Push an event
     if (fileExists)
     {
-        BMCWEB_LOG_DEBUG << "config file is updated";
+        BMCWEB_LOG_DEBUG("config file is updated");
         asyncResp->res.jsonValue["Description"] = "File Updated";
     }
     else
     {
-        BMCWEB_LOG_DEBUG << "config file is created";
+        BMCWEB_LOG_DEBUG("config file is created");
         asyncResp->res.jsonValue["Description"] = "File Created";
     }
 }
@@ -271,9 +271,9 @@
             asyncResp->res.result(
                 boost::beast::http::status::internal_server_error);
             asyncResp->res.jsonValue["Description"] = internalServerError;
-            BMCWEB_LOG_DEBUG << "deleteConfigFiles: Failed to delete the "
-                                "config files directory. ec : "
-                             << ec;
+            BMCWEB_LOG_DEBUG("deleteConfigFiles: Failed to delete the "
+                             "config files directory. ec : {}",
+                             ec.message());
         }
     }
 }
@@ -297,12 +297,12 @@
 inline void handleFileGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                           const std::string& fileID)
 {
-    BMCWEB_LOG_DEBUG << "HandleGet on SaveArea files on path: " << fileID;
+    BMCWEB_LOG_DEBUG("HandleGet on SaveArea files on path: {}", fileID);
     std::filesystem::path loc(
         "/var/lib/bmcweb/ibm-management-console/configfiles/" + fileID);
     if (!std::filesystem::exists(loc) || !std::filesystem::is_regular_file(loc))
     {
-        BMCWEB_LOG_WARNING << loc.string() << " Not found";
+        BMCWEB_LOG_WARNING("{} Not found", loc.string());
         asyncResp->res.result(boost::beast::http::status::not_found);
         asyncResp->res.jsonValue["Description"] = resourceNotFoundMsg;
         return;
@@ -311,7 +311,7 @@
     std::ifstream readfile(loc.string());
     if (!readfile)
     {
-        BMCWEB_LOG_WARNING << loc.string() << " Not found";
+        BMCWEB_LOG_WARNING("{} Not found", loc.string());
         asyncResp->res.result(boost::beast::http::status::not_found);
         asyncResp->res.jsonValue["Description"] = resourceNotFoundMsg;
         return;
@@ -333,18 +333,18 @@
 {
     std::string filePath("/var/lib/bmcweb/ibm-management-console/configfiles/" +
                          fileID);
-    BMCWEB_LOG_DEBUG << "Removing the file : " << filePath << "\n";
+    BMCWEB_LOG_DEBUG("Removing the file : {}", filePath);
     std::ifstream fileOpen(filePath.c_str());
     if (static_cast<bool>(fileOpen))
     {
         if (remove(filePath.c_str()) == 0)
         {
-            BMCWEB_LOG_DEBUG << "File removed!\n";
+            BMCWEB_LOG_DEBUG("File removed!");
             asyncResp->res.jsonValue["Description"] = "File Deleted";
         }
         else
         {
-            BMCWEB_LOG_ERROR << "File not removed!\n";
+            BMCWEB_LOG_ERROR("File not removed!");
             asyncResp->res.result(
                 boost::beast::http::status::internal_server_error);
             asyncResp->res.jsonValue["Description"] = internalServerError;
@@ -352,7 +352,7 @@
     }
     else
     {
-        BMCWEB_LOG_WARNING << "File not found!\n";
+        BMCWEB_LOG_WARNING("File not found!");
         asyncResp->res.result(boost::beast::http::status::not_found);
         asyncResp->res.jsonValue["Description"] = resourceNotFoundMsg;
     }
@@ -367,13 +367,13 @@
     if (!redfish::json_util::readJsonPatch(req, asyncResp->res, "Message",
                                            broadcastMsg))
     {
-        BMCWEB_LOG_DEBUG << "Not a Valid JSON";
+        BMCWEB_LOG_DEBUG("Not a Valid JSON");
         asyncResp->res.result(boost::beast::http::status::bad_request);
         return;
     }
     if (broadcastMsg.size() > maxBroadcastMsgSize)
     {
-        BMCWEB_LOG_ERROR << "Message size exceeds maximum allowed size[1KB]";
+        BMCWEB_LOG_ERROR("Message size exceeds maximum allowed size[1KB]");
         asyncResp->res.result(boost::beast::http::status::bad_request);
         return;
     }
@@ -418,14 +418,14 @@
                                           lockType, "ResourceID", resourceId,
                                           "SegmentFlags", segmentFlags))
         {
-            BMCWEB_LOG_DEBUG << "Not a Valid JSON";
+            BMCWEB_LOG_DEBUG("Not a Valid JSON");
             asyncResp->res.result(boost::beast::http::status::bad_request);
             return;
         }
-        BMCWEB_LOG_DEBUG << lockType;
-        BMCWEB_LOG_DEBUG << resourceId;
+        BMCWEB_LOG_DEBUG("{}", lockType);
+        BMCWEB_LOG_DEBUG("{}", resourceId);
 
-        BMCWEB_LOG_DEBUG << "Segment Flags are present";
+        BMCWEB_LOG_DEBUG("Segment Flags are present");
 
         for (auto& e : segmentFlags)
         {
@@ -440,8 +440,8 @@
                 return;
             }
 
-            BMCWEB_LOG_DEBUG << "Lockflag : " << lockFlags;
-            BMCWEB_LOG_DEBUG << "SegmentLength : " << segmentLength;
+            BMCWEB_LOG_DEBUG("Lockflag : {}", lockFlags);
+            BMCWEB_LOG_DEBUG("SegmentLength : {}", segmentLength);
 
             segInfo.emplace_back(std::make_pair(lockFlags, segmentLength));
         }
@@ -455,14 +455,14 @@
 
     for (auto& i : lockRequestStructure)
     {
-        BMCWEB_LOG_DEBUG << std::get<0>(i);
-        BMCWEB_LOG_DEBUG << std::get<1>(i);
-        BMCWEB_LOG_DEBUG << std::get<2>(i);
-        BMCWEB_LOG_DEBUG << std::get<3>(i);
+        BMCWEB_LOG_DEBUG("{}", std::get<0>(i));
+        BMCWEB_LOG_DEBUG("{}", std::get<1>(i));
+        BMCWEB_LOG_DEBUG("{}", std::get<2>(i));
+        BMCWEB_LOG_DEBUG("{}", std::get<3>(i));
 
         for (const auto& p : std::get<4>(i))
         {
-            BMCWEB_LOG_DEBUG << p.first << ", " << p.second;
+            BMCWEB_LOG_DEBUG("{}, {}", p.first, p.second);
         }
     }
 
@@ -479,14 +479,14 @@
 
         if ((!validityStatus.first) && (validityStatus.second == 0))
         {
-            BMCWEB_LOG_DEBUG << "Not a Valid record";
-            BMCWEB_LOG_DEBUG << "Bad json in request";
+            BMCWEB_LOG_DEBUG("Not a Valid record");
+            BMCWEB_LOG_DEBUG("Bad json in request");
             asyncResp->res.result(boost::beast::http::status::bad_request);
             return;
         }
         if (validityStatus.first && (validityStatus.second == 1))
         {
-            BMCWEB_LOG_ERROR << "There is a conflict within itself";
+            BMCWEB_LOG_ERROR("There is a conflict within itself");
             asyncResp->res.result(boost::beast::http::status::conflict);
             return;
         }
@@ -497,7 +497,7 @@
             std::get<crow::ibm_mc_lock::Rc>(varAcquireLock.second);
         if (!conflictStatus.first)
         {
-            BMCWEB_LOG_DEBUG << "There is no conflict with the locktable";
+            BMCWEB_LOG_DEBUG("There is no conflict with the locktable");
             asyncResp->res.result(boost::beast::http::status::ok);
 
             auto var = std::get<uint32_t>(conflictStatus.second);
@@ -506,7 +506,7 @@
             asyncResp->res.jsonValue["TransactionID"] = var;
             return;
         }
-        BMCWEB_LOG_DEBUG << "There is a conflict with the lock table";
+        BMCWEB_LOG_DEBUG("There is a conflict with the lock table");
         asyncResp->res.result(boost::beast::http::status::conflict);
         auto var =
             std::get<std::pair<uint32_t, LockRequest>>(conflictStatus.second);
@@ -527,7 +527,7 @@
         }
 
         returnJson["SegmentFlags"] = myarray;
-        BMCWEB_LOG_ERROR << "Conflicting lock record: " << returnJson;
+        BMCWEB_LOG_ERROR("Conflicting lock record: {}", returnJson);
         asyncResp->res.jsonValue["Record"] = returnJson;
         return;
     }
@@ -545,11 +545,11 @@
                          const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                          const std::vector<uint32_t>& listTransactionIds)
 {
-    BMCWEB_LOG_DEBUG << listTransactionIds.size();
-    BMCWEB_LOG_DEBUG << "Data is present";
+    BMCWEB_LOG_DEBUG("{}", listTransactionIds.size());
+    BMCWEB_LOG_DEBUG("Data is present");
     for (unsigned int listTransactionId : listTransactionIds)
     {
-        BMCWEB_LOG_DEBUG << listTransactionId;
+        BMCWEB_LOG_DEBUG("{}", listTransactionId);
     }
 
     // validate the request ids
@@ -561,7 +561,7 @@
     if (!varReleaselock.first)
     {
         // validation Failed
-        BMCWEB_LOG_ERROR << "handleReleaseLockAPI: validation failed";
+        BMCWEB_LOG_ERROR("handleReleaseLockAPI: validation failed");
         asyncResp->res.result(boost::beast::http::status::bad_request);
         return;
     }
@@ -575,7 +575,7 @@
     }
 
     // valid rid, but the current hmc does not own all the locks
-    BMCWEB_LOG_DEBUG << "Current HMC does not own all the locks";
+    BMCWEB_LOG_DEBUG("Current HMC does not own all the locks");
     asyncResp->res.result(boost::beast::http::status::unauthorized);
 
     auto var = statusRelease.second;
@@ -596,7 +596,7 @@
     }
 
     returnJson["SegmentFlags"] = myArray;
-    BMCWEB_LOG_DEBUG << "handleReleaseLockAPI: lockrecord: " << returnJson;
+    BMCWEB_LOG_DEBUG("handleReleaseLockAPI: lockrecord: {}", returnJson);
     asyncResp->res.jsonValue["Record"] = returnJson;
 }
 
@@ -604,7 +604,7 @@
     handleGetLockListAPI(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                          const ListOfSessionIds& listSessionIds)
 {
-    BMCWEB_LOG_DEBUG << listSessionIds.size();
+    BMCWEB_LOG_DEBUG("{}", listSessionIds.size());
 
     auto status =
         crow::ibm_mc_lock::Lock::getInstance().getLockList(listSessionIds);
@@ -647,7 +647,7 @@
 {
     if (fileName.empty())
     {
-        BMCWEB_LOG_ERROR << "Empty filename";
+        BMCWEB_LOG_ERROR("Empty filename");
         res.jsonValue["Description"] = "Empty file path in the url";
         return false;
     }
@@ -658,7 +658,7 @@
         "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-");
     if (found != std::string::npos)
     {
-        BMCWEB_LOG_ERROR << "Unsupported character in filename: " << fileName;
+        BMCWEB_LOG_ERROR("Unsupported character in filename: {}", fileName);
         res.jsonValue["Description"] = "Unsupported character in filename";
         return false;
     }
@@ -666,9 +666,9 @@
     // Check the filename length
     if (fileName.length() > 20)
     {
-        BMCWEB_LOG_ERROR << "Name must be maximum 20 characters. "
-                            "Input filename length is: "
-                         << fileName.length();
+        BMCWEB_LOG_ERROR("Name must be maximum 20 characters. "
+                         "Input filename length is: {}",
+                         fileName.length());
         res.jsonValue["Description"] = "Filename must be maximum 20 characters";
         return false;
     }
@@ -721,7 +721,7 @@
             [](const crow::Request& req,
                const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                const std::string& fileName) {
-        BMCWEB_LOG_DEBUG << "ConfigFile : " << fileName;
+        BMCWEB_LOG_DEBUG("ConfigFile : {}", fileName);
         // Validate the incoming fileName
         if (!isValidConfigFileName(fileName, asyncResp->res))
         {
@@ -748,7 +748,7 @@
         if (!redfish::json_util::readJsonAction(req, asyncResp->res, "Request",
                                                 body))
         {
-            BMCWEB_LOG_DEBUG << "Not a Valid JSON";
+            BMCWEB_LOG_DEBUG("Not a Valid JSON");
             asyncResp->res.result(boost::beast::http::status::bad_request);
             return;
         }
@@ -779,8 +779,7 @@
         }
         else
         {
-            BMCWEB_LOG_DEBUG << " Value of Type : " << type
-                             << "is Not a Valid key";
+            BMCWEB_LOG_DEBUG(" Value of Type : {}is Not a Valid key", type);
             redfish::messages::propertyValueNotInList(asyncResp->res, type,
                                                       "Type");
         }
diff --git a/include/ibm/utils.hpp b/include/ibm/utils.hpp
index bb439ee..31f0a2e 100644
--- a/include/ibm/utils.hpp
+++ b/include/ibm/utils.hpp
@@ -15,26 +15,26 @@
     // Create persistent directory
     std::error_code ec;
 
-    BMCWEB_LOG_DEBUG << "Creating persistent directory : " << path;
+    BMCWEB_LOG_DEBUG("Creating persistent directory : {}", path);
 
     bool dirCreated = std::filesystem::create_directories(path, ec);
 
     if (ec)
     {
-        BMCWEB_LOG_ERROR << "Failed to create persistent directory : " << path;
+        BMCWEB_LOG_ERROR("Failed to create persistent directory : {}", path);
         return false;
     }
 
     if (dirCreated)
     {
         // set the permission of the directory to 700
-        BMCWEB_LOG_DEBUG << "Setting the permission to 700";
+        BMCWEB_LOG_DEBUG("Setting the permission to 700");
         std::filesystem::perms permission = std::filesystem::perms::owner_all;
         std::filesystem::permissions(path, permission);
     }
     else
     {
-        BMCWEB_LOG_DEBUG << path << " already exists";
+        BMCWEB_LOG_DEBUG("{} already exists", path);
     }
     return true;
 }
diff --git a/include/image_upload.hpp b/include/image_upload.hpp
index cdd7dd4..521ff65 100644
--- a/include/image_upload.hpp
+++ b/include/image_upload.hpp
@@ -43,11 +43,11 @@
             // expected, we were canceled before the timer completed.
             return;
         }
-        BMCWEB_LOG_ERROR << "Timed out waiting for Version interface";
+        BMCWEB_LOG_ERROR("Timed out waiting for Version interface");
 
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "Async_wait failed " << ec;
+            BMCWEB_LOG_ERROR("Async_wait failed {}", ec);
             return;
         }
 
@@ -60,7 +60,7 @@
 
     std::function<void(sdbusplus::message_t&)> callback =
         [asyncResp](sdbusplus::message_t& m) {
-        BMCWEB_LOG_DEBUG << "Match fired";
+        BMCWEB_LOG_DEBUG("Match fired");
 
         sdbusplus::message::object_path path;
         dbus::utility::DBusInteracesMap interfaces;
@@ -81,7 +81,7 @@
             asyncResp->res.jsonValue["data"] = leaf;
             asyncResp->res.jsonValue["message"] = "200 OK";
             asyncResp->res.jsonValue["status"] = "ok";
-            BMCWEB_LOG_DEBUG << "ending response";
+            BMCWEB_LOG_DEBUG("ending response");
             fwUpdateMatcher = nullptr;
         }
     };
@@ -92,7 +92,7 @@
         callback);
 
     std::string filepath("/tmp/images/" + bmcweb::getRandomUUID());
-    BMCWEB_LOG_DEBUG << "Writing file to " << filepath;
+    BMCWEB_LOG_DEBUG("Writing file to {}", filepath);
     std::ofstream out(filepath, std::ofstream::out | std::ofstream::binary |
                                     std::ofstream::trunc);
     out << req.body();
diff --git a/include/kvm_websocket.hpp b/include/kvm_websocket.hpp
index 8ea3434..e3131bb 100644
--- a/include/kvm_websocket.hpp
+++ b/include/kvm_websocket.hpp
@@ -26,9 +26,9 @@
             endpoint, [this, &connIn](const boost::system::error_code& ec) {
                 if (ec)
                 {
-                    BMCWEB_LOG_ERROR
-                        << "conn:" << &conn
-                        << ", Couldn't connect to KVM socket port: " << ec;
+                    BMCWEB_LOG_ERROR(
+                        "conn:{}, Couldn't connect to KVM socket port: {}",
+                        logPtr(&conn), ec);
                     if (ec != boost::asio::error::operation_aborted)
                     {
                         connIn.close("Error in connecting to KVM port");
@@ -44,23 +44,22 @@
     {
         if (data.length() > inputBuffer.capacity())
         {
-            BMCWEB_LOG_ERROR << "conn:" << &conn
-                             << ", Buffer overrun when writing "
-                             << data.length() << " bytes";
+            BMCWEB_LOG_ERROR("conn:{}, Buffer overrun when writing {} bytes",
+                             logPtr(&conn), data.length());
             conn.close("Buffer overrun");
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "conn:" << &conn << ", Read " << data.size()
-                         << " bytes from websocket";
+        BMCWEB_LOG_DEBUG("conn:{}, Read {} bytes from websocket", logPtr(&conn),
+                         data.size());
         boost::asio::buffer_copy(inputBuffer.prepare(data.size()),
                                  boost::asio::buffer(data));
-        BMCWEB_LOG_DEBUG << "conn:" << &conn << ", Committing " << data.size()
-                         << " bytes from websocket";
+        BMCWEB_LOG_DEBUG("conn:{}, Committing {} bytes from websocket",
+                         logPtr(&conn), data.size());
         inputBuffer.commit(data.size());
 
-        BMCWEB_LOG_DEBUG << "conn:" << &conn << ", inputbuffer size "
-                         << inputBuffer.size();
+        BMCWEB_LOG_DEBUG("conn:{}, inputbuffer size {}", logPtr(&conn),
+                         inputBuffer.size());
         doWrite();
     }
 
@@ -68,18 +67,18 @@
     void doRead()
     {
         std::size_t bytes = outputBuffer.capacity() - outputBuffer.size();
-        BMCWEB_LOG_DEBUG << "conn:" << &conn << ", Reading " << bytes
-                         << " from kvm socket";
+        BMCWEB_LOG_DEBUG("conn:{}, Reading {} from kvm socket", logPtr(&conn),
+                         bytes);
         hostSocket.async_read_some(
             outputBuffer.prepare(outputBuffer.capacity() - outputBuffer.size()),
             [this](const boost::system::error_code& ec, std::size_t bytesRead) {
-            BMCWEB_LOG_DEBUG << "conn:" << &conn << ", read done.  Read "
-                             << bytesRead << " bytes";
+            BMCWEB_LOG_DEBUG("conn:{}, read done.  Read {} bytes",
+                             logPtr(&conn), bytesRead);
             if (ec)
             {
-                BMCWEB_LOG_ERROR
-                    << "conn:" << &conn
-                    << ", Couldn't read from KVM socket port: " << ec;
+                BMCWEB_LOG_ERROR(
+                    "conn:{}, Couldn't read from KVM socket port: {}",
+                    logPtr(&conn), ec);
                 if (ec != boost::asio::error::operation_aborted)
                 {
                     conn.close("Error in connecting to KVM port");
@@ -91,8 +90,8 @@
             std::string_view payload(
                 static_cast<const char*>(outputBuffer.data().data()),
                 bytesRead);
-            BMCWEB_LOG_DEBUG << "conn:" << &conn << ", Sending payload size "
-                             << payload.size();
+            BMCWEB_LOG_DEBUG("conn:{}, Sending payload size {}", logPtr(&conn),
+                             payload.size());
             conn.sendBinary(payload);
             outputBuffer.consume(bytesRead);
 
@@ -104,14 +103,14 @@
     {
         if (doingWrite)
         {
-            BMCWEB_LOG_DEBUG << "conn:" << &conn
-                             << ", Already writing.  Bailing out";
+            BMCWEB_LOG_DEBUG("conn:{}, Already writing.  Bailing out",
+                             logPtr(&conn));
             return;
         }
         if (inputBuffer.size() == 0)
         {
-            BMCWEB_LOG_DEBUG << "conn:" << &conn
-                             << ", inputBuffer empty.  Bailing out";
+            BMCWEB_LOG_DEBUG("conn:{}, inputBuffer empty.  Bailing out",
+                             logPtr(&conn));
             return;
         }
 
@@ -119,8 +118,8 @@
         hostSocket.async_write_some(inputBuffer.data(),
                                     [this](const boost::system::error_code& ec,
                                            std::size_t bytesWritten) {
-            BMCWEB_LOG_DEBUG << "conn:" << &conn << ", Wrote " << bytesWritten
-                             << "bytes";
+            BMCWEB_LOG_DEBUG("conn:{}, Wrote {}bytes", logPtr(&conn),
+                             bytesWritten);
             doingWrite = false;
             inputBuffer.consume(bytesWritten);
 
@@ -131,8 +130,8 @@
             }
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "conn:" << &conn
-                                 << ", Error in KVM socket write " << ec;
+                BMCWEB_LOG_ERROR("conn:{}, Error in KVM socket write {}",
+                                 logPtr(&conn), ec);
                 if (ec != boost::asio::error::operation_aborted)
                 {
                     conn.close("Error in reading to host port");
@@ -164,7 +163,7 @@
         .privileges({{"ConfigureComponents", "ConfigureManager"}})
         .websocket()
         .onopen([](crow::websocket::Connection& conn) {
-            BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened";
+            BMCWEB_LOG_DEBUG("Connection {} opened", logPtr(&conn));
 
             if (sessions.size() == maxSessions)
             {
diff --git a/include/login_routes.hpp b/include/login_routes.hpp
index 482b613..2ed9951 100644
--- a/include/login_routes.hpp
+++ b/include/login_routes.hpp
@@ -41,7 +41,7 @@
                                                      false);
             if (loginCredentials.is_discarded())
             {
-                BMCWEB_LOG_DEBUG << "Bad json in request";
+                BMCWEB_LOG_DEBUG("Bad json in request");
                 asyncResp->res.result(boost::beast::http::status::bad_request);
                 return;
             }
@@ -125,8 +125,8 @@
             if (ec != ParserError::PARSER_SUCCESS)
             {
                 // handle error
-                BMCWEB_LOG_ERROR << "MIME parse failed, ec : "
-                                 << static_cast<int>(ec);
+                BMCWEB_LOG_ERROR("MIME parse failed, ec : {}",
+                                 static_cast<int>(ec));
                 asyncResp->res.result(boost::beast::http::status::bad_request);
                 return;
             }
@@ -137,13 +137,13 @@
                     formpart.fields.find("Content-Disposition");
                 if (it == formpart.fields.end())
                 {
-                    BMCWEB_LOG_ERROR << "Couldn't find Content-Disposition";
+                    BMCWEB_LOG_ERROR("Couldn't find Content-Disposition");
                     asyncResp->res.result(
                         boost::beast::http::status::bad_request);
                     continue;
                 }
 
-                BMCWEB_LOG_INFO << "Parsing value " << it->value();
+                BMCWEB_LOG_INFO("Parsing value {}", it->value());
 
                 if (it->value() == "form-data; name=\"username\"")
                 {
@@ -155,8 +155,7 @@
                 }
                 else
                 {
-                    BMCWEB_LOG_INFO << "Extra format, ignore it."
-                                    << it->value();
+                    BMCWEB_LOG_INFO("Extra format, ignore it.{}", it->value());
                 }
             }
         }
@@ -214,7 +213,7 @@
         }
         else
         {
-            BMCWEB_LOG_DEBUG << "Couldn't interpret password";
+            BMCWEB_LOG_DEBUG("Couldn't interpret password");
             asyncResp->res.result(boost::beast::http::status::bad_request);
         }
         });
diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp
index 62bd324..5de3039 100644
--- a/include/nbd_proxy.hpp
+++ b/include/nbd_proxy.hpp
@@ -57,13 +57,13 @@
 
     ~NbdProxyServer()
     {
-        BMCWEB_LOG_DEBUG << "NbdProxyServer destructor";
+        BMCWEB_LOG_DEBUG("NbdProxyServer destructor");
 
-        BMCWEB_LOG_DEBUG << "peerSocket->close()";
+        BMCWEB_LOG_DEBUG("peerSocket->close()");
         boost::system::error_code ec;
         peerSocket.close(ec);
 
-        BMCWEB_LOG_DEBUG << "std::remove(" << socketId << ")";
+        BMCWEB_LOG_DEBUG("std::remove({})", socketId);
         std::remove(socketId.c_str());
 
         crow::connections::systemBus->async_method_call(
@@ -83,12 +83,12 @@
                                      stream_protocol::socket socket) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "UNIX socket: async_accept error = "
-                                 << ec.message();
+                BMCWEB_LOG_ERROR("UNIX socket: async_accept error = {}",
+                                 ec.message());
                 return;
             }
 
-            BMCWEB_LOG_DEBUG << "Connection opened";
+            BMCWEB_LOG_DEBUG("Connection opened");
             std::shared_ptr<NbdProxyServer> self = weak.lock();
             if (self == nullptr)
             {
@@ -110,8 +110,8 @@
             }
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "DBus error: cannot call mount method = "
-                                 << ec.message();
+                BMCWEB_LOG_ERROR("DBus error: cannot call mount method = {}",
+                                 ec.message());
 
                 self->connection.close("Failed to mount media");
                 return;
@@ -142,8 +142,8 @@
                                      size_t bytesRead) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "UNIX socket: async_read_some error = "
-                                 << ec.message();
+                BMCWEB_LOG_ERROR("UNIX socket: async_read_some error = {}",
+                                 ec.message());
                 return;
             }
             std::shared_ptr<NbdProxyServer> self = weak.lock();
@@ -172,13 +172,13 @@
     {
         if (uxWriteInProgress)
         {
-            BMCWEB_LOG_ERROR << "Write in progress";
+            BMCWEB_LOG_ERROR("Write in progress");
             return;
         }
 
         if (ws2uxBuf.size() == 0)
         {
-            BMCWEB_LOG_ERROR << "No data to write to UNIX socket";
+            BMCWEB_LOG_ERROR("No data to write to UNIX socket");
             return;
         }
 
@@ -199,8 +199,7 @@
 
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "UNIX: async_write error = "
-                                 << ec.message();
+                BMCWEB_LOG_ERROR("UNIX: async_write error = {}", ec.message());
                 self->connection.close("Internal error");
                 return;
             }
@@ -253,7 +252,7 @@
 
     if (ec)
     {
-        BMCWEB_LOG_ERROR << "DBus error: " << ec.message();
+        BMCWEB_LOG_ERROR("DBus error: {}", ec.message());
         conn.close("Failed to create mount point");
         return;
     }
@@ -275,7 +274,7 @@
 
                     if (endpointValue == nullptr)
                     {
-                        BMCWEB_LOG_ERROR << "EndpointId property value is null";
+                        BMCWEB_LOG_ERROR("EndpointId property value is null");
                     }
                 }
                 if (name == "Socket")
@@ -283,7 +282,7 @@
                     socketValue = std::get_if<std::string>(&value);
                     if (socketValue == nullptr)
                     {
-                        BMCWEB_LOG_ERROR << "Socket property value is null";
+                        BMCWEB_LOG_ERROR("Socket property value is null");
                     }
                 }
             }
@@ -299,7 +298,7 @@
 
     if (objects.empty() || endpointObjectPath == nullptr)
     {
-        BMCWEB_LOG_ERROR << "Cannot find requested EndpointId";
+        BMCWEB_LOG_ERROR("Cannot find requested EndpointId");
         conn.close("Failed to match EndpointId");
         return;
     }
@@ -308,7 +307,7 @@
     {
         if (session.second->getEndpointId() == conn.req.target())
         {
-            BMCWEB_LOG_ERROR << "Cannot open new connection - socket is in use";
+            BMCWEB_LOG_ERROR("Cannot open new connection - socket is in use");
             conn.close("Slot is in use");
             return;
         }
@@ -325,7 +324,7 @@
 };
 inline void onOpen(crow::websocket::Connection& conn)
 {
-    BMCWEB_LOG_DEBUG << "nbd-proxy.onopen(" << &conn << ")";
+    BMCWEB_LOG_DEBUG("nbd-proxy.onopen({})", logPtr(&conn));
 
     sdbusplus::message::object_path path("/xyz/openbmc_project/VirtualMedia");
     dbus::utility::getManagedObjects(
@@ -344,11 +343,11 @@
 inline void onClose(crow::websocket::Connection& conn,
                     const std::string& reason)
 {
-    BMCWEB_LOG_DEBUG << "nbd-proxy.onclose(reason = '" << reason << "')";
+    BMCWEB_LOG_DEBUG("nbd-proxy.onclose(reason = '{}')", reason);
     auto session = sessions.find(&conn);
     if (session == sessions.end())
     {
-        BMCWEB_LOG_DEBUG << "No session to close";
+        BMCWEB_LOG_DEBUG("No session to close");
         return;
     }
     // Remove reference to session in global map
@@ -359,7 +358,7 @@
                       crow::websocket::MessageType /*type*/,
                       std::function<void()>&& whenComplete)
 {
-    BMCWEB_LOG_DEBUG << "nbd-proxy.onMessage(len = " << data.size() << ")";
+    BMCWEB_LOG_DEBUG("nbd-proxy.onMessage(len = {})", data.size());
 
     // Acquire proxy from sessions
     auto session = sessions.find(&conn);
diff --git a/include/obmc_console.hpp b/include/obmc_console.hpp
index f9b978d..2dd3edb 100644
--- a/include/obmc_console.hpp
+++ b/include/obmc_console.hpp
@@ -36,13 +36,13 @@
     {
         if (doingWrite)
         {
-            BMCWEB_LOG_DEBUG << "Already writing.  Bailing out";
+            BMCWEB_LOG_DEBUG("Already writing.  Bailing out");
             return;
         }
 
         if (inputBuffer.empty())
         {
-            BMCWEB_LOG_DEBUG << "Outbuffer empty.  Bailing out";
+            BMCWEB_LOG_DEBUG("Outbuffer empty.  Bailing out");
             return;
         }
 
@@ -67,8 +67,7 @@
             }
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "Error in host serial write "
-                                 << ec.message();
+                BMCWEB_LOG_ERROR("Error in host serial write {}", ec.message());
                 return;
             }
             self->doWrite();
@@ -87,12 +86,12 @@
 
     void doRead()
     {
-        BMCWEB_LOG_DEBUG << "Reading from socket";
+        BMCWEB_LOG_DEBUG("Reading from socket");
         hostSocket.async_read_some(
             boost::asio::buffer(outputBuffer),
             [this, weakSelf(weak_from_this())](
                 const boost::system::error_code& ec, std::size_t bytesRead) {
-            BMCWEB_LOG_DEBUG << "read done.  Read " << bytesRead << " bytes";
+            BMCWEB_LOG_DEBUG("read done.  Read {} bytes", bytesRead);
             std::shared_ptr<ConsoleHandler> self = weakSelf.lock();
             if (self == nullptr)
             {
@@ -100,8 +99,8 @@
             }
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "Couldn't read from host serial port: "
-                                 << ec.message();
+                BMCWEB_LOG_ERROR("Couldn't read from host serial port: {}",
+                                 ec.message());
                 conn.close("Error connecting to host port");
                 return;
             }
@@ -120,8 +119,9 @@
 
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "Failed to assign the DBUS socket"
-                             << " Socket assign error: " << ec.message();
+            BMCWEB_LOG_ERROR(
+                "Failed to assign the DBUS socket Socket assign error: {}",
+                ec.message());
             return false;
         }
 
@@ -155,15 +155,15 @@
 // then remove the handler from handlers map.
 inline void onClose(crow::websocket::Connection& conn, const std::string& err)
 {
-    BMCWEB_LOG_INFO << "Closing websocket. Reason: " << err;
+    BMCWEB_LOG_INFO("Closing websocket. Reason: {}", err);
 
     auto iter = getConsoleHandlerMap().find(&conn);
     if (iter == getConsoleHandlerMap().end())
     {
-        BMCWEB_LOG_CRITICAL << "Unable to find connection " << &conn;
+        BMCWEB_LOG_CRITICAL("Unable to find connection {}", logPtr(&conn));
         return;
     }
-    BMCWEB_LOG_DEBUG << "Remove connection " << &conn << " from obmc console";
+    BMCWEB_LOG_DEBUG("Remove connection {} from obmc console", logPtr(&conn));
 
     // Removed last connection so remove the path
     getConsoleHandlerMap().erase(iter);
@@ -175,8 +175,9 @@
 {
     if (ec)
     {
-        BMCWEB_LOG_ERROR << "Failed to call console Connect() method"
-                         << " DBUS error: " << ec.message();
+        BMCWEB_LOG_ERROR(
+            "Failed to call console Connect() method DBUS error: {}",
+            ec.message());
         conn.close("Failed to connect");
         return;
     }
@@ -185,20 +186,20 @@
     auto iter = getConsoleHandlerMap().find(&conn);
     if (iter == getConsoleHandlerMap().end())
     {
-        BMCWEB_LOG_ERROR << "Connection was already closed";
+        BMCWEB_LOG_ERROR("Connection was already closed");
         return;
     }
 
     int fd = dup(unixfd);
     if (fd == -1)
     {
-        BMCWEB_LOG_ERROR << "Failed to dup the DBUS unixfd"
-                         << " error: " << strerror(errno);
+        BMCWEB_LOG_ERROR("Failed to dup the DBUS unixfd error: {}",
+                         strerror(errno));
         conn.close("Internal error");
         return;
     }
 
-    BMCWEB_LOG_DEBUG << "Console unix FD: " << unixfd << " duped FD: " << fd;
+    BMCWEB_LOG_DEBUG("Console duped FD: {}", fd);
 
     if (!iter->second->connect(fd))
     {
@@ -217,14 +218,14 @@
     auto iter = getConsoleHandlerMap().find(&conn);
     if (iter == getConsoleHandlerMap().end())
     {
-        BMCWEB_LOG_ERROR << "Connection was already closed";
+        BMCWEB_LOG_ERROR("Connection was already closed");
         return;
     }
 
     if (ec)
     {
-        BMCWEB_LOG_WARNING << "getDbusObject() for consoles failed. DBUS error:"
-                           << ec.message();
+        BMCWEB_LOG_WARNING("getDbusObject() for consoles failed. DBUS error:{}",
+                           ec.message());
         conn.close("getDbusObject() for consoles failed.");
         return;
     }
@@ -232,15 +233,15 @@
     const auto valueIface = objInfo.begin();
     if (valueIface == objInfo.end())
     {
-        BMCWEB_LOG_WARNING << "getDbusObject() returned unexpected size: "
-                           << objInfo.size();
+        BMCWEB_LOG_WARNING("getDbusObject() returned unexpected size: {}",
+                           objInfo.size());
         conn.close("getDbusObject() returned unexpected size");
         return;
     }
 
     const std::string& consoleService = valueIface->first;
-    BMCWEB_LOG_DEBUG << "Looking up unixFD for Service " << consoleService
-                     << " Path " << consoleObjPath;
+    BMCWEB_LOG_DEBUG("Looking up unixFD for Service {} Path {}", consoleService,
+                     consoleObjPath);
     // Call Connect() method to get the unix FD
     crow::connections::systemBus->async_method_call(
         [&conn](const boost::system::error_code& ec1,
@@ -257,7 +258,7 @@
 {
     std::string consoleLeaf;
 
-    BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened";
+    BMCWEB_LOG_DEBUG("Connection {} opened", logPtr(&conn));
 
     if (getConsoleHandlerMap().size() >= maxSessions)
     {
@@ -286,8 +287,8 @@
         sdbusplus::message::object_path("/xyz/openbmc_project/console") /
         consoleLeaf;
 
-    BMCWEB_LOG_DEBUG << "Console Object path = " << consolePath
-                     << " Request target = " << conn.url().path();
+    BMCWEB_LOG_DEBUG("Console Object path = {} Request target = {}",
+                     consolePath, conn.url().path());
 
     // mapper call lambda
     constexpr std::array<std::string_view, 1> interfaces = {
@@ -307,7 +308,7 @@
     auto handler = getConsoleHandlerMap().find(&conn);
     if (handler == getConsoleHandlerMap().end())
     {
-        BMCWEB_LOG_CRITICAL << "Unable to find connection " << &conn;
+        BMCWEB_LOG_CRITICAL("Unable to find connection {}", logPtr(&conn));
         return;
     }
     handler->second->inputBuffer += data;
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index 4807361..6211fcc 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -135,10 +135,9 @@
             const std::string& introspectXml) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR
-                << "Introspect call failed with error: " << ec.message()
-                << " on process: " << processName << " path: " << objectPath
-                << "\n";
+            BMCWEB_LOG_ERROR(
+                "Introspect call failed with error: {} on process: {} path: {}",
+                ec.message(), processName, objectPath);
             return;
         }
         nlohmann::json::object_t object;
@@ -152,8 +151,8 @@
         tinyxml2::XMLNode* pRoot = doc.FirstChildElement("node");
         if (pRoot == nullptr)
         {
-            BMCWEB_LOG_ERROR << "XML document failed to parse " << processName
-                             << " " << objectPath << "\n";
+            BMCWEB_LOG_ERROR("XML document failed to parse {} {}", processName,
+                             objectPath);
         }
         else
         {
@@ -186,8 +185,8 @@
     const std::string& interface,
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
-    BMCWEB_LOG_DEBUG << "getPropertiesForEnumerate " << objectPath << " "
-                     << service << " " << interface;
+    BMCWEB_LOG_DEBUG("getPropertiesForEnumerate {} {} {}", objectPath, service,
+                     interface);
 
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, service, objectPath, interface,
@@ -196,9 +195,9 @@
                     const dbus::utility::DBusPropertiesMap& propertiesList) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "GetAll on path " << objectPath << " iface "
-                             << interface << " service " << service
-                             << " failed with code " << ec;
+            BMCWEB_LOG_ERROR(
+                "GetAll on path {} iface {} service {} failed with code {}",
+                objectPath, interface, service, ec);
             return;
         }
 
@@ -236,7 +235,7 @@
     const std::shared_ptr<dbus::utility::MapperGetSubTreeResponse>& subtree,
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
-    BMCWEB_LOG_DEBUG << "findRemainingObjectsForEnumerate";
+    BMCWEB_LOG_DEBUG("findRemainingObjectsForEnumerate");
     const nlohmann::json& dataJson = asyncResp->res.jsonValue["data"];
 
     for (const auto& [path, interface_map] : *subtree)
@@ -280,8 +279,8 @@
         }
         catch (...)
         {
-            BMCWEB_LOG_CRITICAL
-                << "findRemainingObjectsForEnumerate threw exception";
+            BMCWEB_LOG_CRITICAL(
+                "findRemainingObjectsForEnumerate threw exception");
         }
     }
 
@@ -299,9 +298,9 @@
     const std::string& connectionName,
     const std::shared_ptr<InProgressEnumerateData>& transaction)
 {
-    BMCWEB_LOG_DEBUG << "getManagedObjectsForEnumerate " << objectName
-                     << " object_manager_path " << objectManagerPath
-                     << " connection_name " << connectionName;
+    BMCWEB_LOG_DEBUG(
+        "getManagedObjectsForEnumerate {} object_manager_path {} connection_name {}",
+        objectName, objectManagerPath, connectionName);
     sdbusplus::message::object_path path(objectManagerPath);
     dbus::utility::getManagedObjects(
         connectionName, path,
@@ -310,9 +309,9 @@
                          const dbus::utility::ManagedObjectType& objects) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "GetManagedObjects on path " << objectName
-                             << " on connection " << connectionName
-                             << " failed with code " << ec;
+            BMCWEB_LOG_ERROR(
+                "GetManagedObjects on path {} on connection {} failed with code {}",
+                objectName, connectionName, ec);
             return;
         }
 
@@ -323,7 +322,7 @@
         {
             if (objectPath.first.str.starts_with(objectName))
             {
-                BMCWEB_LOG_DEBUG << "Reading object " << objectPath.first.str;
+                BMCWEB_LOG_DEBUG("Reading object {}", objectPath.first.str);
                 nlohmann::json& objectJson = dataJson[objectPath.first.str];
                 if (objectJson.is_null())
                 {
@@ -369,16 +368,16 @@
     const std::string& objectName, const std::string& connectionName,
     const std::shared_ptr<InProgressEnumerateData>& transaction)
 {
-    BMCWEB_LOG_DEBUG << "Finding objectmanager for path " << objectName
-                     << " on connection:" << connectionName;
+    BMCWEB_LOG_DEBUG("Finding objectmanager for path {} on connection:{}",
+                     objectName, connectionName);
     crow::connections::systemBus->async_method_call(
         [transaction, objectName, connectionName](
             const boost::system::error_code& ec,
             const dbus::utility::MapperGetAncestorsResponse& objects) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "GetAncestors on path " << objectName
-                             << " failed with code " << ec;
+            BMCWEB_LOG_ERROR("GetAncestors on path {} failed with code {}",
+                             objectName, ec);
             return;
         }
 
@@ -414,13 +413,13 @@
                       const dbus::utility::MapperGetObject& objects) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "GetObject for path " << transaction->objectPath
-                             << " failed with code " << ec;
+            BMCWEB_LOG_ERROR("GetObject for path {} failed with code {}",
+                             transaction->objectPath, ec);
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "GetObject for " << transaction->objectPath
-                         << " has " << objects.size() << " entries";
+        BMCWEB_LOG_DEBUG("GetObject for {} has {} entries",
+                         transaction->objectPath, objects.size());
         if (!objects.empty())
         {
             transaction->subtree->emplace_back(transaction->objectPath,
@@ -437,18 +436,18 @@
             {
                 for (const auto& interface : connection.second)
                 {
-                    BMCWEB_LOG_DEBUG << connection.first << " has interface "
-                                     << interface;
+                    BMCWEB_LOG_DEBUG("{} has interface {}", connection.first,
+                                     interface);
                     if (interface == "org.freedesktop.DBus.ObjectManager")
                     {
-                        BMCWEB_LOG_DEBUG << "found object manager path "
-                                         << object.first;
+                        BMCWEB_LOG_DEBUG("found object manager path {}",
+                                         object.first);
                         connections[connection.first] = object.first;
                     }
                 }
             }
         }
-        BMCWEB_LOG_DEBUG << "Got " << connections.size() << " connections";
+        BMCWEB_LOG_DEBUG("Got {} connections", connections.size());
 
         for (const auto& connection : connections)
         {
@@ -596,10 +595,10 @@
                              const nlohmann::json& inputJson)
 {
     int r = 0;
-    BMCWEB_LOG_DEBUG << "Converting "
-                     << inputJson.dump(2, ' ', true,
-                                       nlohmann::json::error_handler_t::replace)
-                     << " to type: " << argType;
+    BMCWEB_LOG_DEBUG(
+        "Converting {} to type: {}",
+        inputJson.dump(2, ' ', true, nlohmann::json::error_handler_t::replace),
+        argType);
     const std::vector<std::string> argTypes = dbusArgSplit(argType);
 
     // Assume a single object for now.
@@ -840,8 +839,8 @@
         else if (argCode.starts_with("v"))
         {
             std::string containedType = argCode.substr(1);
-            BMCWEB_LOG_DEBUG << "variant type: " << argCode
-                             << " appending variant of type: " << containedType;
+            BMCWEB_LOG_DEBUG("variant type: {} appending variant of type: {}",
+                             argCode, containedType);
             r = sd_bus_message_open_container(m, SD_BUS_TYPE_VARIANT,
                                               containedType.c_str());
             if (r < 0)
@@ -947,8 +946,8 @@
     int r = sd_bus_message_read_basic(m.get(), typeCode.front(), &value);
     if (r < 0)
     {
-        BMCWEB_LOG_ERROR << "sd_bus_message_read_basic on type " << typeCode
-                         << " failed!";
+        BMCWEB_LOG_ERROR("sd_bus_message_read_basic on type {} failed!",
+                         typeCode);
         return r;
     }
 
@@ -966,8 +965,8 @@
     std::vector<std::string> types = dbusArgSplit(typeCode);
     if (types.size() != 2)
     {
-        BMCWEB_LOG_ERROR << "wrong number contained types in dictionary: "
-                         << types.size();
+        BMCWEB_LOG_ERROR("wrong number contained types in dictionary: {}",
+                         types.size());
         return -1;
     }
 
@@ -975,7 +974,7 @@
                                            typeCode.c_str());
     if (r < 0)
     {
-        BMCWEB_LOG_ERROR << "sd_bus_message_enter_container with rc " << r;
+        BMCWEB_LOG_ERROR("sd_bus_message_enter_container with rc {}", r);
         return r;
     }
 
@@ -1011,7 +1010,7 @@
     r = sd_bus_message_exit_container(m.get());
     if (r < 0)
     {
-        BMCWEB_LOG_ERROR << "sd_bus_message_exit_container failed";
+        BMCWEB_LOG_ERROR("sd_bus_message_exit_container failed");
         return r;
     }
 
@@ -1023,8 +1022,7 @@
 {
     if (typeCode.size() < 2)
     {
-        BMCWEB_LOG_ERROR << "Type code " << typeCode
-                         << " too small for an array";
+        BMCWEB_LOG_ERROR("Type code {} too small for an array", typeCode);
         return -1;
     }
 
@@ -1034,8 +1032,7 @@
                                            containedType.c_str());
     if (r < 0)
     {
-        BMCWEB_LOG_ERROR << "sd_bus_message_enter_container failed with rc "
-                         << r;
+        BMCWEB_LOG_ERROR("sd_bus_message_enter_container failed with rc {}", r);
         return r;
     }
 
@@ -1057,7 +1054,7 @@
         r = sd_bus_message_at_end(m.get(), 0);
         if (r < 0)
         {
-            BMCWEB_LOG_ERROR << "sd_bus_message_at_end failed";
+            BMCWEB_LOG_ERROR("sd_bus_message_at_end failed");
             return r;
         }
 
@@ -1090,7 +1087,7 @@
     r = sd_bus_message_exit_container(m.get());
     if (r < 0)
     {
-        BMCWEB_LOG_ERROR << "sd_bus_message_exit_container failed";
+        BMCWEB_LOG_ERROR("sd_bus_message_exit_container failed");
         return r;
     }
 
@@ -1102,8 +1099,7 @@
 {
     if (typeCode.size() < 3)
     {
-        BMCWEB_LOG_ERROR << "Type code " << typeCode
-                         << " too small for a struct";
+        BMCWEB_LOG_ERROR("Type code {} too small for a struct", typeCode);
         return -1;
     }
 
@@ -1114,8 +1110,7 @@
                                            containedTypes.c_str());
     if (r < 0)
     {
-        BMCWEB_LOG_ERROR << "sd_bus_message_enter_container failed with rc "
-                         << r;
+        BMCWEB_LOG_ERROR("sd_bus_message_enter_container failed with rc {}", r);
         return r;
     }
 
@@ -1132,7 +1127,7 @@
     r = sd_bus_message_exit_container(m.get());
     if (r < 0)
     {
-        BMCWEB_LOG_ERROR << "sd_bus_message_exit_container failed";
+        BMCWEB_LOG_ERROR("sd_bus_message_exit_container failed");
         return r;
     }
     return 0;
@@ -1144,7 +1139,7 @@
     int r = sd_bus_message_peek_type(m.get(), nullptr, &containerType);
     if (r < 0)
     {
-        BMCWEB_LOG_ERROR << "sd_bus_message_peek_type failed";
+        BMCWEB_LOG_ERROR("sd_bus_message_peek_type failed");
         return r;
     }
 
@@ -1152,8 +1147,7 @@
                                        containerType);
     if (r < 0)
     {
-        BMCWEB_LOG_ERROR << "sd_bus_message_enter_container failed with rc "
-                         << r;
+        BMCWEB_LOG_ERROR("sd_bus_message_enter_container failed with rc {}", r);
         return r;
     }
 
@@ -1166,7 +1160,7 @@
     r = sd_bus_message_exit_container(m.get());
     if (r < 0)
     {
-        BMCWEB_LOG_ERROR << "sd_bus_message_enter_container failed";
+        BMCWEB_LOG_ERROR("sd_bus_message_enter_container failed");
         return r;
     }
 
@@ -1304,7 +1298,7 @@
         }
         else
         {
-            BMCWEB_LOG_ERROR << "Invalid D-Bus signature type " << typeCode;
+            BMCWEB_LOG_ERROR("Invalid D-Bus signature type {}", typeCode);
             return -2;
         }
     }
@@ -1380,18 +1374,17 @@
     const std::shared_ptr<InProgressActionData>& transaction,
     const std::string& connectionName)
 {
-    BMCWEB_LOG_DEBUG << "findActionOnInterface for connection "
-                     << connectionName;
+    BMCWEB_LOG_DEBUG("findActionOnInterface for connection {}", connectionName);
     crow::connections::systemBus->async_method_call(
         [transaction, connectionName{std::string(connectionName)}](
             const boost::system::error_code& ec,
             const std::string& introspectXml) {
-        BMCWEB_LOG_DEBUG << "got xml:\n " << introspectXml;
+        BMCWEB_LOG_DEBUG("got xml:\n {}", introspectXml);
         if (ec)
         {
-            BMCWEB_LOG_ERROR
-                << "Introspect call failed with error: " << ec.message()
-                << " on process: " << connectionName << "\n";
+            BMCWEB_LOG_ERROR(
+                "Introspect call failed with error: {} on process: {}",
+                ec.message(), connectionName);
             return;
         }
         tinyxml2::XMLDocument doc;
@@ -1400,8 +1393,7 @@
         tinyxml2::XMLNode* pRoot = doc.FirstChildElement("node");
         if (pRoot == nullptr)
         {
-            BMCWEB_LOG_ERROR << "XML document failed to parse "
-                             << connectionName << "\n";
+            BMCWEB_LOG_ERROR("XML document failed to parse {}", connectionName);
             return;
         }
         tinyxml2::XMLElement* interfaceNode =
@@ -1424,13 +1416,13 @@
                 while (methodNode != nullptr)
                 {
                     const char* thisMethodName = methodNode->Attribute("name");
-                    BMCWEB_LOG_DEBUG << "Found method: " << thisMethodName;
+                    BMCWEB_LOG_DEBUG("Found method: {}", thisMethodName);
                     if (thisMethodName != nullptr &&
                         thisMethodName == transaction->methodName)
                     {
-                        BMCWEB_LOG_DEBUG << "Found method named "
-                                         << thisMethodName << " on interface "
-                                         << thisInterfaceName;
+                        BMCWEB_LOG_DEBUG(
+                            "Found method named {} on interface {}",
+                            thisMethodName, thisInterfaceName);
                         sdbusplus::message_t m =
                             crow::connections::systemBus->new_method_call(
                                 connectionName.c_str(),
@@ -1540,8 +1532,8 @@
                          const std::string& objectPath,
                          const std::string& methodName)
 {
-    BMCWEB_LOG_DEBUG << "handleAction on path: " << objectPath << " and method "
-                     << methodName;
+    BMCWEB_LOG_DEBUG("handleAction on path: {} and method {}", objectPath,
+                     methodName);
     nlohmann::json requestDbusData;
 
     JsonParseResult ret = parseRequestAsJson(req, requestDbusData);
@@ -1588,15 +1580,15 @@
                 interfaceNames) {
         if (ec || interfaceNames.empty())
         {
-            BMCWEB_LOG_ERROR << "Can't find object";
+            BMCWEB_LOG_ERROR("Can't find object");
             setErrorResponse(transaction->asyncResp->res,
                              boost::beast::http::status::not_found,
                              notFoundDesc, notFoundMsg);
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "GetObject returned " << interfaceNames.size()
-                         << " object(s)";
+        BMCWEB_LOG_DEBUG("GetObject returned {} object(s)",
+                         interfaceNames.size());
 
         for (const std::pair<std::string, std::vector<std::string>>& object :
              interfaceNames)
@@ -1609,7 +1601,7 @@
 inline void handleDelete(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                          const std::string& objectPath)
 {
-    BMCWEB_LOG_DEBUG << "handleDelete on path: " << objectPath;
+    BMCWEB_LOG_DEBUG("handleDelete on path: {}", objectPath);
 
     dbus::utility::getDbusObject(
         objectPath, {},
@@ -1619,7 +1611,7 @@
                 interfaceNames) {
         if (ec || interfaceNames.empty())
         {
-            BMCWEB_LOG_ERROR << "Can't find object";
+            BMCWEB_LOG_ERROR("Can't find object");
             setErrorResponse(asyncResp->res,
                              boost::beast::http::status::method_not_allowed,
                              methodNotAllowedDesc, methodNotAllowedMsg);
@@ -1665,7 +1657,7 @@
 inline void handleEnumerate(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                             const std::string& objectPath)
 {
-    BMCWEB_LOG_DEBUG << "Doing enumerate on " << objectPath;
+    BMCWEB_LOG_DEBUG("Doing enumerate on {}", objectPath);
 
     asyncResp->res.jsonValue["message"] = "200 OK";
     asyncResp->res.jsonValue["status"] = "ok";
@@ -1685,8 +1677,8 @@
 
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "GetSubTree failed on "
-                             << transaction->objectPath;
+            BMCWEB_LOG_ERROR("GetSubTree failed on {}",
+                             transaction->objectPath);
             setErrorResponse(transaction->asyncResp->res,
                              boost::beast::http::status::not_found,
                              notFoundDesc, notFoundMsg);
@@ -1702,7 +1694,7 @@
 inline void handleGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                       std::string& objectPath, std::string& destProperty)
 {
-    BMCWEB_LOG_DEBUG << "handleGet: " << objectPath << " prop:" << destProperty;
+    BMCWEB_LOG_DEBUG("handleGet: {} prop:{}", objectPath, destProperty);
     std::shared_ptr<std::string> propertyName =
         std::make_shared<std::string>(std::move(destProperty));
 
@@ -1751,8 +1743,7 @@
                                       sdbusplus::message_t& msg) {
                         if (ec2)
                         {
-                            BMCWEB_LOG_ERROR << "Bad dbus request error: "
-                                             << ec2;
+                            BMCWEB_LOG_ERROR("Bad dbus request error: {}", ec2);
                         }
                         else
                         {
@@ -1760,7 +1751,7 @@
                             int r = convertDBusToJSON("a{sv}", msg, properties);
                             if (r < 0)
                             {
-                                BMCWEB_LOG_ERROR << "convertDBusToJSON failed";
+                                BMCWEB_LOG_ERROR("convertDBusToJSON failed");
                             }
                             else
                             {
@@ -1904,9 +1895,9 @@
                               const std::string& introspectXml) {
                 if (ec3)
                 {
-                    BMCWEB_LOG_ERROR << "Introspect call failed with error: "
-                                     << ec3.message()
-                                     << " on process: " << connectionName;
+                    BMCWEB_LOG_ERROR(
+                        "Introspect call failed with error: {} on process: {}",
+                        ec3.message(), connectionName);
                     transaction->setErrorStatus("Unexpected Error");
                     return;
                 }
@@ -1916,8 +1907,8 @@
                 tinyxml2::XMLNode* pRoot = doc.FirstChildElement("node");
                 if (pRoot == nullptr)
                 {
-                    BMCWEB_LOG_ERROR << "XML document failed to parse: "
-                                     << introspectXml;
+                    BMCWEB_LOG_ERROR("XML document failed to parse: {}",
+                                     introspectXml);
                     transaction->setErrorStatus("Unexpected Error");
                     return;
                 }
@@ -1926,13 +1917,13 @@
                 while (ifaceNode != nullptr)
                 {
                     const char* interfaceName = ifaceNode->Attribute("name");
-                    BMCWEB_LOG_DEBUG << "found interface " << interfaceName;
+                    BMCWEB_LOG_DEBUG("found interface {}", interfaceName);
                     tinyxml2::XMLElement* propNode =
                         ifaceNode->FirstChildElement("property");
                     while (propNode != nullptr)
                     {
                         const char* propertyName = propNode->Attribute("name");
-                        BMCWEB_LOG_DEBUG << "Found property " << propertyName;
+                        BMCWEB_LOG_DEBUG("Found property {}", propertyName);
                         if (propertyName == transaction->propertyName)
                         {
                             const char* argType = propNode->Attribute("type");
@@ -1987,7 +1978,7 @@
                                     [transaction](
                                         const boost::system::error_code& ec,
                                         sdbusplus::message_t& m2) {
-                                    BMCWEB_LOG_DEBUG << "sent";
+                                    BMCWEB_LOG_DEBUG("sent");
                                     if (ec)
                                     {
                                         const sd_bus_error* e = m2.get_error();
@@ -2161,10 +2152,9 @@
                          const std::string& introspectXml) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR
-                    << "Introspect call failed with error: " << ec.message()
-                    << " on process: " << processName << " path: " << objectPath
-                    << "\n";
+                BMCWEB_LOG_ERROR(
+                    "Introspect call failed with error: {} on process: {} path: {}",
+                    ec.message(), processName, objectPath);
                 return;
             }
             tinyxml2::XMLDocument doc;
@@ -2173,15 +2163,15 @@
             tinyxml2::XMLNode* pRoot = doc.FirstChildElement("node");
             if (pRoot == nullptr)
             {
-                BMCWEB_LOG_ERROR << "XML document failed to parse "
-                                 << processName << " " << objectPath << "\n";
+                BMCWEB_LOG_ERROR("XML document failed to parse {} {}",
+                                 processName, objectPath);
                 asyncResp->res.jsonValue["status"] = "XML parse error";
                 asyncResp->res.result(
                     boost::beast::http::status::internal_server_error);
                 return;
             }
 
-            BMCWEB_LOG_DEBUG << introspectXml;
+            BMCWEB_LOG_DEBUG("{}", introspectXml);
             asyncResp->res.jsonValue["status"] = "ok";
             asyncResp->res.jsonValue["bus_name"] = processName;
             asyncResp->res.jsonValue["object_path"] = objectPath;
@@ -2216,10 +2206,9 @@
                             const std::string& introspectXml) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR
-                    << "Introspect call failed with error: " << ec.message()
-                    << " on process: " << processName << " path: " << objectPath
-                    << "\n";
+                BMCWEB_LOG_ERROR(
+                    "Introspect call failed with error: {} on process: {} path: {}",
+                    ec.message(), processName, objectPath);
                 return;
             }
             tinyxml2::XMLDocument doc;
@@ -2228,8 +2217,8 @@
             tinyxml2::XMLNode* pRoot = doc.FirstChildElement("node");
             if (pRoot == nullptr)
             {
-                BMCWEB_LOG_ERROR << "XML document failed to parse "
-                                 << processName << " " << objectPath << "\n";
+                BMCWEB_LOG_ERROR("XML document failed to parse {} {}",
+                                 processName, objectPath);
                 asyncResp->res.result(
                     boost::beast::http::status::internal_server_error);
                 return;
@@ -2448,7 +2437,7 @@
                                       std::vector<std::string>& names) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "Dbus call failed with code " << ec;
+                BMCWEB_LOG_ERROR("Dbus call failed with code {}", ec);
                 asyncResp->res.result(
                     boost::beast::http::status::internal_server_error);
             }
@@ -2538,7 +2527,7 @@
         if (!std::filesystem::exists(loc) ||
             !std::filesystem::is_directory(loc))
         {
-            BMCWEB_LOG_ERROR << loc.string() << "Not found";
+            BMCWEB_LOG_ERROR("{}Not found", loc.string());
             asyncResp->res.result(boost::beast::http::status::not_found);
             return;
         }
@@ -2565,7 +2554,7 @@
             static std::regex dumpFileRegex("[a-zA-Z0-9\\._]+");
             if (!std::regex_match(dumpFileName, dumpFileRegex))
             {
-                BMCWEB_LOG_ERROR << "Invalid dump filename " << dumpFileName;
+                BMCWEB_LOG_ERROR("Invalid dump filename {}", dumpFileName);
                 asyncResp->res.result(boost::beast::http::status::not_found);
                 return;
             }
diff --git a/include/persistent_data.hpp b/include/persistent_data.hpp
index a08ca7e..5079a8c 100644
--- a/include/persistent_data.hpp
+++ b/include/persistent_data.hpp
@@ -57,8 +57,7 @@
             auto data = nlohmann::json::parse(persistentFile, nullptr, false);
             if (data.is_discarded())
             {
-                BMCWEB_LOG_ERROR
-                    << "Error parsing persistent data in json file.";
+                BMCWEB_LOG_ERROR("Error parsing persistent data in json file.");
             }
             else
             {
@@ -72,7 +71,7 @@
                             item.value().get_ptr<const uint64_t*>();
                         if (uintPtr == nullptr)
                         {
-                            BMCWEB_LOG_ERROR << "Failed to read revision flag";
+                            BMCWEB_LOG_ERROR("Failed to read revision flag");
                         }
                         else
                         {
@@ -103,15 +102,15 @@
 
                             if (newSession == nullptr)
                             {
-                                BMCWEB_LOG_ERROR << "Problem reading session "
-                                                    "from persistent store";
+                                BMCWEB_LOG_ERROR("Problem reading session "
+                                                 "from persistent store");
                                 continue;
                             }
 
-                            BMCWEB_LOG_DEBUG
-                                << "Restored session: " << newSession->csrfToken
-                                << " " << newSession->uniqueId << " "
-                                << newSession->sessionToken;
+                            BMCWEB_LOG_DEBUG("Restored session: {} {} {}",
+                                             newSession->csrfToken,
+                                             newSession->uniqueId,
+                                             newSession->sessionToken);
                             SessionStore::getInstance().authTokens.emplace(
                                 newSession->sessionToken, newSession);
                         }
@@ -122,13 +121,13 @@
                             item.value().get_ptr<int64_t*>();
                         if (jTimeout == nullptr)
                         {
-                            BMCWEB_LOG_DEBUG
-                                << "Problem reading session timeout value";
+                            BMCWEB_LOG_DEBUG(
+                                "Problem reading session timeout value");
                             continue;
                         }
                         std::chrono::seconds sessionTimeoutInseconds(*jTimeout);
-                        BMCWEB_LOG_DEBUG << "Restored Session Timeout: "
-                                         << sessionTimeoutInseconds.count();
+                        BMCWEB_LOG_DEBUG("Restored Session Timeout: {}",
+                                         sessionTimeoutInseconds.count());
                         SessionStore::getInstance().updateSessionTimeout(
                             sessionTimeoutInseconds);
                     }
@@ -147,15 +146,14 @@
 
                             if (newSubscription == nullptr)
                             {
-                                BMCWEB_LOG_ERROR
-                                    << "Problem reading subscription "
-                                       "from persistent store";
+                                BMCWEB_LOG_ERROR("Problem reading subscription "
+                                                 "from persistent store");
                                 continue;
                             }
 
-                            BMCWEB_LOG_DEBUG << "Restored subscription: "
-                                             << newSubscription->id << " "
-                                             << newSubscription->customText;
+                            BMCWEB_LOG_DEBUG("Restored subscription: {} {}",
+                                             newSubscription->id,
+                                             newSubscription->customText);
                             EventServiceStore::getInstance()
                                 .subscriptionsConfigMap.emplace(
                                     newSubscription->id, newSubscription);
@@ -251,8 +249,7 @@
             std::shared_ptr<UserSubscription> subValue = it.second;
             if (subValue->subscriptionType == "SSE")
             {
-                BMCWEB_LOG_DEBUG
-                    << "The subscription type is SSE, so skipping.";
+                BMCWEB_LOG_DEBUG("The subscription type is SSE, so skipping.");
                 continue;
             }
             nlohmann::json::object_t headers;
diff --git a/include/sessions.hpp b/include/sessions.hpp
index 9179723..cb7f78e 100644
--- a/include/sessions.hpp
+++ b/include/sessions.hpp
@@ -72,8 +72,9 @@
                 element.value().get_ptr<const std::string*>();
             if (thisValue == nullptr)
             {
-                BMCWEB_LOG_ERROR << "Error reading persistent store.  Property "
-                                 << element.key() << " was not of type string";
+                BMCWEB_LOG_ERROR(
+                    "Error reading persistent store.  Property {} was not of type string",
+                    element.key());
                 continue;
             }
             if (element.key() == "unique_id")
@@ -103,9 +104,9 @@
 
             else
             {
-                BMCWEB_LOG_ERROR
-                    << "Got unexpected property reading persistent file: "
-                    << element.key();
+                BMCWEB_LOG_ERROR(
+                    "Got unexpected property reading persistent file: {}",
+                    element.key());
                 continue;
             }
         }
@@ -116,8 +117,8 @@
         if (userSession->uniqueId.empty() || userSession->username.empty() ||
             userSession->sessionToken.empty() || userSession->csrfToken.empty())
         {
-            BMCWEB_LOG_DEBUG << "Session missing required security "
-                                "information, refusing to restore";
+            BMCWEB_LOG_DEBUG("Session missing required security "
+                             "information, refusing to restore");
             return nullptr;
         }
 
diff --git a/include/ssl_key_handler.hpp b/include/ssl_key_handler.hpp
index abc9b50..f8142cf 100644
--- a/include/ssl_key_handler.hpp
+++ b/include/ssl_key_handler.hpp
@@ -1,5 +1,7 @@
 #pragma once
 
+#include "bmcweb_config.h"
+
 #include "logging.hpp"
 #include "ossl_random.hpp"
 
@@ -46,7 +48,7 @@
     X509_STORE* x509Store = X509_STORE_new();
     if (x509Store == nullptr)
     {
-        BMCWEB_LOG_ERROR << "Error occurred during X509_STORE_new call";
+        BMCWEB_LOG_ERROR("Error occurred during X509_STORE_new call");
         return false;
     }
 
@@ -54,7 +56,7 @@
     X509_STORE_CTX* storeCtx = X509_STORE_CTX_new();
     if (storeCtx == nullptr)
     {
-        BMCWEB_LOG_ERROR << "Error occurred during X509_STORE_CTX_new call";
+        BMCWEB_LOG_ERROR("Error occurred during X509_STORE_CTX_new call");
         X509_STORE_free(x509Store);
         return false;
     }
@@ -62,7 +64,7 @@
     int errCode = X509_STORE_CTX_init(storeCtx, x509Store, cert, nullptr);
     if (errCode != 1)
     {
-        BMCWEB_LOG_ERROR << "Error occurred during X509_STORE_CTX_init call";
+        BMCWEB_LOG_ERROR("Error occurred during X509_STORE_CTX_init call");
         X509_STORE_CTX_free(storeCtx);
         X509_STORE_free(x509Store);
         return false;
@@ -71,7 +73,7 @@
     errCode = X509_verify_cert(storeCtx);
     if (errCode == 1)
     {
-        BMCWEB_LOG_INFO << "Certificate verification is success";
+        BMCWEB_LOG_INFO("Certificate verification is success");
         X509_STORE_CTX_free(storeCtx);
         X509_STORE_free(x509Store);
         return true;
@@ -83,18 +85,17 @@
         X509_STORE_free(x509Store);
         if (isTrustChainError(errCode))
         {
-            BMCWEB_LOG_DEBUG << "Ignoring Trust Chain error. Reason: "
-                             << X509_verify_cert_error_string(errCode);
+            BMCWEB_LOG_DEBUG("Ignoring Trust Chain error. Reason: {}",
+                             X509_verify_cert_error_string(errCode));
             return true;
         }
-        BMCWEB_LOG_ERROR << "Certificate verification failed. Reason: "
-                         << X509_verify_cert_error_string(errCode);
+        BMCWEB_LOG_ERROR("Certificate verification failed. Reason: {}",
+                         X509_verify_cert_error_string(errCode));
         return false;
     }
 
-    BMCWEB_LOG_ERROR
-        << "Error occurred during X509_verify_cert call. ErrorCode: "
-        << errCode;
+    BMCWEB_LOG_ERROR(
+        "Error occurred during X509_verify_cert call. ErrorCode: {}", errCode);
     X509_STORE_CTX_free(storeCtx);
     X509_STORE_free(x509Store);
     return false;
@@ -203,24 +204,24 @@
     BIO* certFileBio = BIO_new_file(filePath.c_str(), "rb");
     if (certFileBio == nullptr)
     {
-        BMCWEB_LOG_ERROR << "Error occured during BIO_new_file call, "
-                         << "FILE= " << filePath;
+        BMCWEB_LOG_ERROR("Error occured during BIO_new_file call, FILE= {}",
+                         filePath);
         return nullptr;
     }
 
     X509* cert = X509_new();
     if (cert == nullptr)
     {
-        BMCWEB_LOG_ERROR << "Error occured during X509_new call, "
-                         << ERR_get_error();
+        BMCWEB_LOG_ERROR("Error occured during X509_new call, {}",
+                         ERR_get_error());
         BIO_free(certFileBio);
         return nullptr;
     }
 
     if (PEM_read_bio_X509(certFileBio, &cert, nullptr, nullptr) == nullptr)
     {
-        BMCWEB_LOG_ERROR << "Error occured during PEM_read_bio_X509 call, "
-                         << "FILE= " << filePath;
+        BMCWEB_LOG_ERROR(
+            "Error occured during PEM_read_bio_X509 call, FILE= {}", filePath);
 
         BIO_free(certFileBio);
         X509_free(cert);
@@ -240,7 +241,7 @@
     ex = X509V3_EXT_conf_nid(nullptr, &ctx, nid, const_cast<char*>(value));
     if (ex == nullptr)
     {
-        BMCWEB_LOG_ERROR << "Error: In X509V3_EXT_conf_nidn: " << value;
+        BMCWEB_LOG_ERROR("Error: In X509V3_EXT_conf_nidn: {}", value);
         return -1;
     }
     X509_add_ext(cert, ex, -1);
@@ -476,7 +477,7 @@
 
     SSL_CTX_set_options(mSslContext->native_handle(), SSL_OP_NO_RENEGOTIATION);
 
-    BMCWEB_LOG_DEBUG << "Using default TrustStore location: " << trustStorePath;
+    BMCWEB_LOG_DEBUG("Using default TrustStore location: {}", trustStorePath);
     mSslContext->add_verify_path(trustStorePath);
 
     mSslContext->use_certificate_file(sslPemFile,
@@ -497,9 +498,7 @@
     // drop, use the right way
     // http://stackoverflow.com/questions/18929049/boost-asio-with-ecdsa-certificate-issue
     if (SSL_CTX_set_ecdh_auto(mSslContext->native_handle(), 1) != 1)
-    {
-        BMCWEB_LOG_ERROR << "Error setting tmp ecdh list\n";
-    }
+    {}
 
     // Mozilla intermediate cipher suites v5.7
     // Sourced from: https://ssl-config.mozilla.org/guidelines/5.7.json
@@ -516,7 +515,7 @@
     if (SSL_CTX_set_cipher_list(mSslContext->native_handle(),
                                 mozillaIntermediate) != 1)
     {
-        BMCWEB_LOG_ERROR << "Error setting cipher list\n";
+        BMCWEB_LOG_ERROR("Error setting cipher list");
     }
     return mSslContext;
 }
@@ -537,7 +536,7 @@
                        ec);
     if (ec)
     {
-        BMCWEB_LOG_ERROR << "SSL context set_options failed";
+        BMCWEB_LOG_ERROR("SSL context set_options failed");
         return std::nullopt;
     }
 
@@ -546,7 +545,7 @@
     sslCtx.set_default_verify_paths(ec);
     if (ec)
     {
-        BMCWEB_LOG_ERROR << "SSL context set_default_verify failed";
+        BMCWEB_LOG_ERROR("SSL context set_default_verify failed");
         return std::nullopt;
     }
 
@@ -554,7 +553,7 @@
     sslCtx.set_verify_mode(boost::asio::ssl::verify_peer, ec);
     if (ec)
     {
-        BMCWEB_LOG_ERROR << "SSL context set_verify_mode failed";
+        BMCWEB_LOG_ERROR("SSL context set_verify_mode failed");
         return std::nullopt;
     }
 
@@ -574,7 +573,7 @@
 
     if (SSL_CTX_set_cipher_list(sslCtx.native_handle(), sslCiphers) != 1)
     {
-        BMCWEB_LOG_ERROR << "SSL_CTX_set_cipher_list failed";
+        BMCWEB_LOG_ERROR("SSL_CTX_set_cipher_list failed");
         return std::nullopt;
     }
 
diff --git a/include/vm_websocket.hpp b/include/vm_websocket.hpp
index 1e1b7e1..1b06a93 100644
--- a/include/vm_websocket.hpp
+++ b/include/vm_websocket.hpp
@@ -46,7 +46,7 @@
         int rc = kill(proxy.id(), SIGTERM);
         if (rc != 0)
         {
-            BMCWEB_LOG_ERROR << "Failed to terminate nbd-proxy: " << errno;
+            BMCWEB_LOG_ERROR("Failed to terminate nbd-proxy: {}", errno);
             return;
         }
 
@@ -61,8 +61,7 @@
                                       boost::process::std_in < pipeIn, ec);
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "Couldn't connect to nbd-proxy: "
-                             << ec.message();
+            BMCWEB_LOG_ERROR("Couldn't connect to nbd-proxy: {}", ec.message());
             if (session != nullptr)
             {
                 session->close("Error connecting to nbd-proxy");
@@ -77,13 +76,13 @@
     {
         if (doingWrite)
         {
-            BMCWEB_LOG_DEBUG << "Already writing.  Bailing out";
+            BMCWEB_LOG_DEBUG("Already writing.  Bailing out");
             return;
         }
 
         if (inputBuffer->size() == 0)
         {
-            BMCWEB_LOG_DEBUG << "inputBuffer empty.  Bailing out";
+            BMCWEB_LOG_DEBUG("inputBuffer empty.  Bailing out");
             return;
         }
 
@@ -92,7 +91,7 @@
             inputBuffer->data(),
             [this, self(shared_from_this())](const boost::beast::error_code& ec,
                                              std::size_t bytesWritten) {
-            BMCWEB_LOG_DEBUG << "Wrote " << bytesWritten << "bytes";
+            BMCWEB_LOG_DEBUG("Wrote {}bytes", bytesWritten);
             doingWrite = false;
             inputBuffer->consume(bytesWritten);
 
@@ -108,7 +107,7 @@
             if (ec)
             {
                 session->close("Error in writing to proxy port");
-                BMCWEB_LOG_ERROR << "Error in VM socket write " << ec;
+                BMCWEB_LOG_ERROR("Error in VM socket write {}", ec);
                 return;
             }
             doWrite();
@@ -123,10 +122,10 @@
             outputBuffer->prepare(bytes),
             [this, self(shared_from_this())](
                 const boost::system::error_code& ec, std::size_t bytesRead) {
-            BMCWEB_LOG_DEBUG << "Read done.  Read " << bytesRead << " bytes";
+            BMCWEB_LOG_DEBUG("Read done.  Read {} bytes", bytesRead);
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "Couldn't read from VM port: " << ec;
+                BMCWEB_LOG_ERROR("Couldn't read from VM port: {}", ec);
                 if (session != nullptr)
                 {
                     session->close("Error in connecting to VM port");
@@ -170,7 +169,7 @@
         .privileges({{"ConfigureComponents", "ConfigureManager"}})
         .websocket()
         .onopen([](crow::websocket::Connection& conn) {
-            BMCWEB_LOG_DEBUG << "Connection " << &conn << " opened";
+            BMCWEB_LOG_DEBUG("Connection {} opened", logPtr(&conn));
 
             if (session != nullptr)
             {
@@ -210,8 +209,8 @@
             if (data.length() >
                 handler->inputBuffer->capacity() - handler->inputBuffer->size())
             {
-                BMCWEB_LOG_ERROR << "Buffer overrun when writing "
-                                 << data.length() << " bytes";
+                BMCWEB_LOG_ERROR("Buffer overrun when writing {} bytes",
+                                 data.length());
                 conn.close("Buffer overrun");
                 return;
             }
diff --git a/include/webassets.hpp b/include/webassets.hpp
index ca41374..4deb7a7 100644
--- a/include/webassets.hpp
+++ b/include/webassets.hpp
@@ -57,8 +57,9 @@
     std::filesystem::recursive_directory_iterator dirIter(rootpath, ec);
     if (ec)
     {
-        BMCWEB_LOG_ERROR << "Unable to find or open " << rootpath.string()
-                         << " static file hosting disabled";
+        BMCWEB_LOG_ERROR(
+            "Unable to find or open {} static file hosting disabled",
+            rootpath.string());
         return;
     }
 
@@ -117,7 +118,7 @@
             {
                 // Got a duplicated path.  This is expected in certain
                 // situations
-                BMCWEB_LOG_DEBUG << "Got duplicated path " << webpath.string();
+                BMCWEB_LOG_DEBUG("Got duplicated path {}", webpath.string());
                 continue;
             }
             const char* contentType = nullptr;
@@ -136,9 +137,9 @@
 
             if (contentType == nullptr)
             {
-                BMCWEB_LOG_ERROR << "Cannot determine content-type for "
-                                 << absolutePath.string() << " with extension "
-                                 << extension;
+                BMCWEB_LOG_ERROR(
+                    "Cannot determine content-type for {} with extension {}",
+                    absolutePath.string(), extension);
             }
 
             if (webpath == "/")
@@ -167,7 +168,7 @@
                 std::ifstream inf(absolutePath);
                 if (!inf)
                 {
-                    BMCWEB_LOG_DEBUG << "failed to read file";
+                    BMCWEB_LOG_DEBUG("failed to read file");
                     asyncResp->res.result(
                         boost::beast::http::status::internal_server_error);
                     return;
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
index a1c4fb9..00d77c8 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -287,13 +287,13 @@
     // NOLINTNEXTLINE
     bmcweb::split(result, sseFilter, ' ');
 
-    BMCWEB_LOG_DEBUG << "No of tokens in SEE query: " << result.size();
+    BMCWEB_LOG_DEBUG("No of tokens in SEE query: {}", result.size());
 
     constexpr uint8_t divisor = 4;
     constexpr uint8_t minTokenSize = 3;
     if (result.size() % divisor != minTokenSize)
     {
-        BMCWEB_LOG_ERROR << "Invalid SSE filter specified.";
+        BMCWEB_LOG_ERROR("Invalid SSE filter specified.");
         return false;
     }
 
@@ -309,8 +309,8 @@
             // SSE supports only "or" and "and" in query params.
             if ((separator != "or") && (separator != "and"))
             {
-                BMCWEB_LOG_ERROR
-                    << "Invalid group operator in SSE query parameters";
+                BMCWEB_LOG_ERROR(
+                    "Invalid group operator in SSE query parameters");
                 return false;
             }
         }
@@ -318,12 +318,12 @@
         // SSE supports only "eq" as per spec.
         if (op != "eq")
         {
-            BMCWEB_LOG_ERROR
-                << "Invalid assignment operator in SSE query parameters";
+            BMCWEB_LOG_ERROR(
+                "Invalid assignment operator in SSE query parameters");
             return false;
         }
 
-        BMCWEB_LOG_DEBUG << key << " : " << value;
+        BMCWEB_LOG_DEBUG("{} : {}", key, value);
         if (key == "EventFormatType")
         {
             formatType = value;
@@ -342,8 +342,7 @@
         }
         else
         {
-            BMCWEB_LOG_ERROR << "Invalid property(" << key
-                             << ")in SSE filter query.";
+            BMCWEB_LOG_ERROR("Invalid property({})in SSE filter query.", key);
             return false;
         }
     }
@@ -477,14 +476,14 @@
                                                messageArgsView, timestamp,
                                                customText, bmcLogEntry) != 0)
             {
-                BMCWEB_LOG_DEBUG << "Read eventLog entry failed";
+                BMCWEB_LOG_DEBUG("Read eventLog entry failed");
                 continue;
             }
         }
 
         if (logEntryArray.empty())
         {
-            BMCWEB_LOG_DEBUG << "No log entries available to be transferred.";
+            BMCWEB_LOG_DEBUG("No log entries available to be transferred.");
             return;
         }
 
@@ -521,9 +520,9 @@
         nlohmann::json msg;
         if (!telemetry::fillReport(msg, reportId, var))
         {
-            BMCWEB_LOG_ERROR << "Failed to fill the MetricReport for DBus "
-                                "Report with id "
-                             << reportId;
+            BMCWEB_LOG_ERROR("Failed to fill the MetricReport for DBus "
+                             "Report with id {}",
+                             reportId);
             return;
         }
 
@@ -553,7 +552,7 @@
 
     void setSubscriptionId(const std::string& id2)
     {
-        BMCWEB_LOG_DEBUG << "Subscription ID: " << id2;
+        BMCWEB_LOG_DEBUG("Subscription ID: {}", id2);
         subId = id2;
     }
 
@@ -582,8 +581,8 @@
     // policy.  2XX is considered acceptable
     static boost::system::error_code retryRespHandler(unsigned int respCode)
     {
-        BMCWEB_LOG_DEBUG
-            << "Checking response code validity for SubscriptionEvent";
+        BMCWEB_LOG_DEBUG(
+            "Checking response code validity for SubscriptionEvent");
         if ((respCode < 200) || (respCode >= 300))
         {
             return boost::system::errc::make_error_code(
@@ -661,8 +660,8 @@
 
             if (!status)
             {
-                BMCWEB_LOG_ERROR
-                    << "Failed to validate and split destination url";
+                BMCWEB_LOG_ERROR(
+                    "Failed to validate and split destination url");
                 continue;
             }
             std::shared_ptr<Subscription> subValue =
@@ -683,7 +682,7 @@
 
             if (subValue->id.empty())
             {
-                BMCWEB_LOG_ERROR << "Failed to add subscription";
+                BMCWEB_LOG_ERROR("Failed to add subscription");
             }
             subscriptionsMap.insert(std::pair(subValue->id, subValue));
 
@@ -704,13 +703,13 @@
         std::ifstream eventConfigFile(eventServiceFile);
         if (!eventConfigFile.good())
         {
-            BMCWEB_LOG_DEBUG << "Old eventService config not exist";
+            BMCWEB_LOG_DEBUG("Old eventService config not exist");
             return;
         }
         auto jsonData = nlohmann::json::parse(eventConfigFile, nullptr, false);
         if (jsonData.is_discarded())
         {
-            BMCWEB_LOG_ERROR << "Old eventService config parse error.";
+            BMCWEB_LOG_ERROR("Old eventService config parse error.");
             return;
         }
 
@@ -732,8 +731,8 @@
                                                                         true);
                     if (newSubscription == nullptr)
                     {
-                        BMCWEB_LOG_ERROR << "Problem reading subscription "
-                                            "from old persistent store";
+                        BMCWEB_LOG_ERROR("Problem reading subscription "
+                                         "from old persistent store");
                         continue;
                     }
 
@@ -765,9 +764,9 @@
 
                     if (retry <= 0)
                     {
-                        BMCWEB_LOG_ERROR
-                            << "Failed to generate random number from old "
-                               "persistent store";
+                        BMCWEB_LOG_ERROR(
+                            "Failed to generate random number from old "
+                            "persistent store");
                         continue;
                     }
                 }
@@ -775,7 +774,7 @@
 
             persistent_data::getConfig().writeData();
             std::remove(eventServiceFile);
-            BMCWEB_LOG_DEBUG << "Remove old eventservice config";
+            BMCWEB_LOG_DEBUG("Remove old eventservice config");
         }
     }
 
@@ -878,7 +877,7 @@
         auto obj = subscriptionsMap.find(id);
         if (obj == subscriptionsMap.end())
         {
-            BMCWEB_LOG_ERROR << "No subscription exist with ID:" << id;
+            BMCWEB_LOG_ERROR("No subscription exist with ID:{}", id);
             return nullptr;
         }
         std::shared_ptr<Subscription> subValue = obj->second;
@@ -912,7 +911,7 @@
 
         if (retry <= 0)
         {
-            BMCWEB_LOG_ERROR << "Failed to generate random number";
+            BMCWEB_LOG_ERROR("Failed to generate random number");
             return "";
         }
 
@@ -1024,7 +1023,7 @@
             std::shared_ptr<Subscription> entry = it.second;
             if (entry->destinationUrl == destUrl)
             {
-                BMCWEB_LOG_ERROR << "Destination exist already" << destUrl;
+                BMCWEB_LOG_ERROR("Destination exist already{}", destUrl);
                 return true;
             }
         }
@@ -1049,7 +1048,7 @@
     {
         if (!serviceEnabled || (noOfEventLogSubscribers == 0U))
         {
-            BMCWEB_LOG_DEBUG << "EventService disabled or no Subscriptions.";
+            BMCWEB_LOG_DEBUG("EventService disabled or no Subscriptions.");
             return;
         }
         nlohmann::json eventRecord = nlohmann::json::array();
@@ -1076,8 +1075,9 @@
                 {
                     if (resType == resource)
                     {
-                        BMCWEB_LOG_INFO << "ResourceType " << resource
-                                        << " found in the subscribed list";
+                        BMCWEB_LOG_INFO(
+                            "ResourceType {} found in the subscribed list",
+                            resource);
                         isSubscribed = true;
                         break;
                     }
@@ -1103,7 +1103,7 @@
             }
             else
             {
-                BMCWEB_LOG_INFO << "Not subscribed to this resource";
+                BMCWEB_LOG_INFO("Not subscribed to this resource");
             }
         }
     }
@@ -1124,7 +1124,7 @@
         std::ifstream logStream(redfishEventLogFile);
         if (!logStream.good())
         {
-            BMCWEB_LOG_ERROR << " Redfish log file open failed \n";
+            BMCWEB_LOG_ERROR(" Redfish log file open failed ");
             return;
         }
         std::string logEntry;
@@ -1132,8 +1132,6 @@
         {
             redfishLogFilePosition = logStream.tellg();
         }
-
-        BMCWEB_LOG_DEBUG << "Next Log Position : " << redfishLogFilePosition;
     }
 
     void readEventLogsFromFile()
@@ -1141,7 +1139,7 @@
         std::ifstream logStream(redfishEventLogFile);
         if (!logStream.good())
         {
-            BMCWEB_LOG_ERROR << " Redfish log file open failed";
+            BMCWEB_LOG_ERROR(" Redfish log file open failed");
             return;
         }
 
@@ -1177,7 +1175,7 @@
             if (event_log::getEventLogParams(logEntry, timestamp, messageID,
                                              messageArgs) != 0)
             {
-                BMCWEB_LOG_DEBUG << "Read eventLog entry params failed";
+                BMCWEB_LOG_DEBUG("Read eventLog entry params failed");
                 continue;
             }
 
@@ -1196,14 +1194,14 @@
 
         if (!serviceEnabled || noOfEventLogSubscribers == 0)
         {
-            BMCWEB_LOG_DEBUG << "EventService disabled or no Subscriptions.";
+            BMCWEB_LOG_DEBUG("EventService disabled or no Subscriptions.");
             return;
         }
 
         if (eventRecords.empty())
         {
             // No Records to send
-            BMCWEB_LOG_DEBUG << "No log entries available to be transferred.";
+            BMCWEB_LOG_DEBUG("No log entries available to be transferred.");
             return;
         }
 
@@ -1231,7 +1229,7 @@
                                          const std::size_t& bytesTransferred) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "Callback Error: " << ec.message();
+                BMCWEB_LOG_ERROR("Callback Error: {}", ec.message());
                 return;
             }
             std::size_t index = 0;
@@ -1256,16 +1254,16 @@
                         continue;
                     }
 
-                    BMCWEB_LOG_DEBUG
-                        << "Redfish log file created/deleted. event.name: "
-                        << fileName;
+                    BMCWEB_LOG_DEBUG(
+                        "Redfish log file created/deleted. event.name: {}",
+                        fileName);
                     if (event.mask == IN_CREATE)
                     {
                         if (fileWatchDesc != -1)
                         {
-                            BMCWEB_LOG_DEBUG
-                                << "Remove and Add inotify watcher on "
-                                   "redfish event log file";
+                            BMCWEB_LOG_DEBUG(
+                                "Remove and Add inotify watcher on "
+                                "redfish event log file");
                             // Remove existing inotify watcher and add
                             // with new redfish event log file.
                             inotify_rm_watch(inotifyFd, fileWatchDesc);
@@ -1276,8 +1274,8 @@
                             inotifyFd, redfishEventLogFile, IN_MODIFY);
                         if (fileWatchDesc == -1)
                         {
-                            BMCWEB_LOG_ERROR << "inotify_add_watch failed for "
-                                                "redfish log file.";
+                            BMCWEB_LOG_ERROR("inotify_add_watch failed for "
+                                             "redfish log file.");
                             return;
                         }
 
@@ -1317,7 +1315,7 @@
         inotifyFd = inotify_init1(IN_NONBLOCK);
         if (inotifyFd == -1)
         {
-            BMCWEB_LOG_ERROR << "inotify_init1 failed.";
+            BMCWEB_LOG_ERROR("inotify_init1 failed.");
             return -1;
         }
 
@@ -1327,8 +1325,8 @@
                                          IN_CREATE | IN_MOVED_TO | IN_DELETE);
         if (dirWatchDesc == -1)
         {
-            BMCWEB_LOG_ERROR
-                << "inotify_add_watch failed for event log directory.";
+            BMCWEB_LOG_ERROR(
+                "inotify_add_watch failed for event log directory.");
             return -1;
         }
 
@@ -1337,8 +1335,7 @@
                                           IN_MODIFY);
         if (fileWatchDesc == -1)
         {
-            BMCWEB_LOG_ERROR
-                << "inotify_add_watch failed for redfish log file.";
+            BMCWEB_LOG_ERROR("inotify_add_watch failed for redfish log file.");
             // Don't return error if file not exist.
             // Watch on directory will handle create/delete of file.
         }
@@ -1355,7 +1352,7 @@
     {
         if (msg.is_method_error())
         {
-            BMCWEB_LOG_ERROR << "TelemetryMonitor Signal error";
+            BMCWEB_LOG_ERROR("TelemetryMonitor Signal error");
             return;
         }
 
@@ -1363,7 +1360,7 @@
         std::string id = path.filename();
         if (id.empty())
         {
-            BMCWEB_LOG_ERROR << "Failed to get Id from path";
+            BMCWEB_LOG_ERROR("Failed to get Id from path");
             return;
         }
 
@@ -1377,7 +1374,7 @@
                          [](const auto& x) { return x.first == "Readings"; });
         if (found == props.end())
         {
-            BMCWEB_LOG_INFO << "Failed to get Readings from Report properties";
+            BMCWEB_LOG_INFO("Failed to get Readings from Report properties");
             return;
         }
 
@@ -1385,7 +1382,7 @@
             std::get_if<telemetry::TimestampReadings>(&found->second);
         if (readings == nullptr)
         {
-            BMCWEB_LOG_INFO << "Failed to get Readings from Report properties";
+            BMCWEB_LOG_INFO("Failed to get Readings from Report properties");
             return;
         }
 
@@ -1404,7 +1401,7 @@
     {
         if (matchTelemetryMonitor)
         {
-            BMCWEB_LOG_DEBUG << "Metrics report signal - Unregister";
+            BMCWEB_LOG_DEBUG("Metrics report signal - Unregister");
             matchTelemetryMonitor.reset();
             matchTelemetryMonitor = nullptr;
         }
@@ -1414,11 +1411,11 @@
     {
         if (!serviceEnabled || matchTelemetryMonitor)
         {
-            BMCWEB_LOG_DEBUG << "Not registering metric report signal.";
+            BMCWEB_LOG_DEBUG("Not registering metric report signal.");
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "Metrics report signal - Register";
+        BMCWEB_LOG_DEBUG("Metrics report signal - Register");
         std::string matchStr = "type='signal',member='PropertiesChanged',"
                                "interface='org.freedesktop.DBus.Properties',"
                                "arg0=xyz.openbmc_project.Telemetry.Report";
diff --git a/redfish-core/include/gzfile.hpp b/redfish-core/include/gzfile.hpp
index 34bc151..3fa1e49 100644
--- a/redfish-core/include/gzfile.hpp
+++ b/redfish-core/include/gzfile.hpp
@@ -18,7 +18,7 @@
         gzFile logStream = gzopen(filename.c_str(), "r");
         if (logStream == nullptr)
         {
-            BMCWEB_LOG_ERROR << "Can't open gz file: " << filename << '\n';
+            BMCWEB_LOG_ERROR("Can't open gz file: {}", filename);
             return false;
         }
 
@@ -46,9 +46,9 @@
         int errNum = 0;
         const char* errMsg = gzerror(logStream, &errNum);
 
-        BMCWEB_LOG_ERROR << "Error reading gz compressed data.\n"
-                         << "Error Message: " << errMsg << '\n'
-                         << "Error Number: " << errNum;
+        BMCWEB_LOG_ERROR(
+            "Error reading gz compressed data.\nError Message: {}\nError Number: {}",
+            errMsg, errNum);
     }
 
     bool readFile(gzFile logStream, uint64_t skip, uint64_t top,
@@ -71,7 +71,7 @@
             bufferStr.resize(static_cast<size_t>(bytesRead));
             if (!hostLogEntryParser(bufferStr, skip, top, logEntries, logCount))
             {
-                BMCWEB_LOG_ERROR << "Error occurs during parsing host log.\n";
+                BMCWEB_LOG_ERROR("Error occurs during parsing host log.");
                 return false;
             }
         } while (gzeof(logStream) != 1);
@@ -114,9 +114,9 @@
                     totalFilesSize += logEntry.size();
                     if (totalFilesSize > maxTotalFilesSize)
                     {
-                        BMCWEB_LOG_ERROR
-                            << "File size exceeds maximum allowed size of "
-                            << maxTotalFilesSize;
+                        BMCWEB_LOG_ERROR(
+                            "File size exceeds maximum allowed size of {}",
+                            maxTotalFilesSize);
                         return false;
                     }
                     logEntries.push_back(logEntry);
@@ -145,9 +145,9 @@
                         totalFilesSize++;
                         if (totalFilesSize > maxTotalFilesSize)
                         {
-                            BMCWEB_LOG_ERROR
-                                << "File size exceeds maximum allowed size of "
-                                << maxTotalFilesSize;
+                            BMCWEB_LOG_ERROR(
+                                "File size exceeds maximum allowed size of {}",
+                                maxTotalFilesSize);
                             return false;
                         }
                         logEntries.emplace_back("\n");
@@ -188,9 +188,9 @@
                 size_t tmpMessageSize = totalFilesSize + lastMessage.size();
                 if (tmpMessageSize > maxTotalFilesSize)
                 {
-                    BMCWEB_LOG_ERROR
-                        << "File size exceeds maximum allowed size of "
-                        << maxTotalFilesSize;
+                    BMCWEB_LOG_ERROR(
+                        "File size exceeds maximum allowed size of {}",
+                        maxTotalFilesSize);
                     return false;
                 }
             }
diff --git a/redfish-core/include/privileges.hpp b/redfish-core/include/privileges.hpp
index bb2c2f3..8b42208 100644
--- a/redfish-core/include/privileges.hpp
+++ b/redfish-core/include/privileges.hpp
@@ -102,8 +102,8 @@
         {
             if (!setSinglePrivilege(privilege))
             {
-                BMCWEB_LOG_CRITICAL << "Unable to set privilege " << privilege
-                                    << "in constructor";
+                BMCWEB_LOG_CRITICAL("Unable to set privilege {}in constructor",
+                                    privilege);
             }
         }
     }
@@ -295,10 +295,10 @@
     }
     for (const auto& requiredPrivileges : operationPrivilegesRequired)
     {
-        BMCWEB_LOG_DEBUG << "Checking operation privileges...";
+        BMCWEB_LOG_DEBUG("Checking operation privileges...");
         if (userPrivileges.isSupersetOf(requiredPrivileges))
         {
-            BMCWEB_LOG_DEBUG << "...success";
+            BMCWEB_LOG_DEBUG("...success");
             return true;
         }
     }
diff --git a/redfish-core/include/query.hpp b/redfish-core/include/query.hpp
index c1ca38e..78de6ca 100644
--- a/redfish-core/include/query.hpp
+++ b/redfish-core/include/query.hpp
@@ -38,8 +38,8 @@
                         const crow::Response& resIn)
 {
     std::string computedEtag = resIn.computeEtag();
-    BMCWEB_LOG_DEBUG << "User provided if-match etag " << ifMatchHeader
-                     << " computed etag " << computedEtag;
+    BMCWEB_LOG_DEBUG("User provided if-match etag {} computed etag {}",
+                     ifMatchHeader, computedEtag);
     if (computedEtag != ifMatchHeader)
     {
         messages::preconditionFailed(asyncResp->res);
@@ -47,7 +47,7 @@
     }
     // Restart the request without if-match
     req.req.erase(boost::beast::http::field::if_match);
-    BMCWEB_LOG_DEBUG << "Restarting request";
+    BMCWEB_LOG_DEBUG("Restarting request");
     app.handle(req, asyncResp);
 }
 
@@ -118,7 +118,7 @@
     query_param::Query& delegated,
     const query_param::QueryCapabilities& queryCapabilities)
 {
-    BMCWEB_LOG_DEBUG << "setup redfish route";
+    BMCWEB_LOG_DEBUG("setup redfish route");
 
     // Section 7.4 of the redfish spec "Redfish Services shall process the
     // [OData-Version header] in the following table as defined by the HTTP 1.1
diff --git a/redfish-core/include/redfish_aggregator.hpp b/redfish-core/include/redfish_aggregator.hpp
index 7cae89a..59a4eb9 100644
--- a/redfish-core/include/redfish_aggregator.hpp
+++ b/redfish-core/include/redfish_aggregator.hpp
@@ -83,8 +83,8 @@
             uri.substr(serviceRootUri.size(), parseCount));
     if (!parsedUrl)
     {
-        BMCWEB_LOG_ERROR << "Failed to get target URI from "
-                         << uri.substr(serviceRootUri.size());
+        BMCWEB_LOG_ERROR("Failed to get target URI from {}",
+                         uri.substr(serviceRootUri.size()));
         return false;
     }
 
@@ -165,7 +165,7 @@
     auto parsed = boost::urls::parse_relative_ref(strValue);
     if (!parsed)
     {
-        BMCWEB_LOG_CRITICAL << "Couldn't parse URI from resource " << strValue;
+        BMCWEB_LOG_CRITICAL("Couldn't parse URI from resource {}", strValue);
         return;
     }
 
@@ -178,7 +178,7 @@
     if (crow::utility::readUrlSegments(thisUrl, "redfish", "v1", "JsonSchemas",
                                        crow::utility::OrMorePaths()))
     {
-        BMCWEB_LOG_DEBUG << "Skipping JsonSchemas URI prefix fixing";
+        BMCWEB_LOG_DEBUG("Skipping JsonSchemas URI prefix fixing");
         return;
     }
 
@@ -244,7 +244,7 @@
     std::string* strValue = item.get_ptr<std::string*>();
     if (strValue == nullptr)
     {
-        BMCWEB_LOG_CRITICAL << "Field wasn't a string????";
+        BMCWEB_LOG_CRITICAL("Field wasn't a string????");
         return;
     }
     addPrefixToStringItem(*strValue, prefix);
@@ -288,7 +288,7 @@
     nlohmann::json::array_t* array = json.get_ptr<nlohmann::json::array_t*>();
     if (array == nullptr)
     {
-        BMCWEB_LOG_ERROR << "Field wasn't an array_t????";
+        BMCWEB_LOG_ERROR("Field wasn't an array_t????");
         return;
     }
 
@@ -298,7 +298,7 @@
         std::string* strHeader = item.get_ptr<std::string*>();
         if (strHeader == nullptr)
         {
-            BMCWEB_LOG_CRITICAL << "Field wasn't a string????";
+            BMCWEB_LOG_CRITICAL("Field wasn't a string????");
             continue;
         }
 
@@ -355,7 +355,7 @@
 {
     // Allow all response codes because we want to surface any satellite
     // issue to the client
-    BMCWEB_LOG_DEBUG << "Received " << respCode << " response from satellite";
+    BMCWEB_LOG_DEBUG("Received {} response from satellite", respCode);
     return boost::system::errc::make_error_code(boost::system::errc::success);
 }
 
@@ -382,13 +382,12 @@
     {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "Something went wrong while querying dbus!";
+            BMCWEB_LOG_ERROR("Something went wrong while querying dbus!");
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "There were "
-                         << std::to_string(satelliteInfo.size())
-                         << " satellite configs found at startup";
+        BMCWEB_LOG_DEBUG("There were {} satellite configs found at startup",
+                         std::to_string(satelliteInfo.size()));
     }
 
     // Search D-Bus objects for satellite config objects and add their
@@ -404,14 +403,14 @@
                 if (interface.first ==
                     "xyz.openbmc_project.Configuration.SatelliteController")
                 {
-                    BMCWEB_LOG_DEBUG << "Found Satellite Controller at "
-                                     << objectPath.first.str;
+                    BMCWEB_LOG_DEBUG("Found Satellite Controller at {}",
+                                     objectPath.first.str);
 
                     if (!satelliteInfo.empty())
                     {
-                        BMCWEB_LOG_ERROR
-                            << "Redfish Aggregation only supports one satellite!";
-                        BMCWEB_LOG_DEBUG << "Clearing all satellite data";
+                        BMCWEB_LOG_ERROR(
+                            "Redfish Aggregation only supports one satellite!");
+                        BMCWEB_LOG_DEBUG("Clearing all satellite data");
                         satelliteInfo.clear();
                         return;
                     }
@@ -442,7 +441,7 @@
                     std::get_if<std::string>(&prop.second);
                 if (propVal == nullptr)
                 {
-                    BMCWEB_LOG_ERROR << "Invalid Hostname value";
+                    BMCWEB_LOG_ERROR("Invalid Hostname value");
                     return;
                 }
                 url.set_host(*propVal);
@@ -453,13 +452,13 @@
                 const uint64_t* propVal = std::get_if<uint64_t>(&prop.second);
                 if (propVal == nullptr)
                 {
-                    BMCWEB_LOG_ERROR << "Invalid Port value";
+                    BMCWEB_LOG_ERROR("Invalid Port value");
                     return;
                 }
 
                 if (*propVal > std::numeric_limits<uint16_t>::max())
                 {
-                    BMCWEB_LOG_ERROR << "Port value out of range";
+                    BMCWEB_LOG_ERROR("Port value out of range");
                     return;
                 }
                 url.set_port(std::to_string(static_cast<uint16_t>(*propVal)));
@@ -471,7 +470,7 @@
                     std::get_if<std::string>(&prop.second);
                 if (propVal == nullptr)
                 {
-                    BMCWEB_LOG_ERROR << "Invalid AuthType value";
+                    BMCWEB_LOG_ERROR("Invalid AuthType value");
                     return;
                 }
 
@@ -479,9 +478,9 @@
                 // with the satellite BMC
                 if (*propVal != "None")
                 {
-                    BMCWEB_LOG_ERROR
-                        << "Unsupported AuthType value: " << *propVal
-                        << ", only \"none\" is supported";
+                    BMCWEB_LOG_ERROR(
+                        "Unsupported AuthType value: {}, only \"none\" is supported",
+                        *propVal);
                     return;
                 }
                 url.set_scheme("http");
@@ -491,20 +490,19 @@
         // Make sure all required config information was made available
         if (url.host().empty())
         {
-            BMCWEB_LOG_ERROR << "Satellite config " << name << " missing Host";
+            BMCWEB_LOG_ERROR("Satellite config {} missing Host", name);
             return;
         }
 
         if (!url.has_port())
         {
-            BMCWEB_LOG_ERROR << "Satellite config " << name << " missing Port";
+            BMCWEB_LOG_ERROR("Satellite config {} missing Port", name);
             return;
         }
 
         if (!url.has_scheme())
         {
-            BMCWEB_LOG_ERROR << "Satellite config " << name
-                             << " missing AuthType";
+            BMCWEB_LOG_ERROR("Satellite config {} missing AuthType", name);
             return;
         }
 
@@ -519,9 +517,9 @@
             resultString = "Updated existing satellite config ";
         }
 
-        BMCWEB_LOG_DEBUG << resultString << name << " at "
-                         << result.first->second.scheme() << "://"
-                         << result.first->second.encoded_host_and_port();
+        BMCWEB_LOG_DEBUG("{}{} at {}://{}", resultString, name,
+                         result.first->second.scheme(),
+                         result.first->second.encoded_host_and_port());
     }
 
     enum AggregationType
@@ -539,15 +537,15 @@
         {
             if (aggType == AggregationType::Collection)
             {
-                BMCWEB_LOG_DEBUG
-                    << "Only aggregate GET requests to top level collections";
+                BMCWEB_LOG_DEBUG(
+                    "Only aggregate GET requests to top level collections");
                 return;
             }
 
             if (aggType == AggregationType::ContainsSubordinate)
             {
-                BMCWEB_LOG_DEBUG << "Only aggregate GET requests when uptree of"
-                                 << " a top level collection";
+                BMCWEB_LOG_DEBUG(
+                    "Only aggregate GET requests when uptree of a top level collection");
                 return;
             }
         }
@@ -557,7 +555,7 @@
         auto localReq = std::make_shared<crow::Request>(thisReq.req, ec);
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "Failed to create copy of request";
+            BMCWEB_LOG_ERROR("Failed to create copy of request");
             if (aggType == AggregationType::Resource)
             {
                 messages::internalError(asyncResp->res);
@@ -582,8 +580,7 @@
             targetPrefix += "_";
             if (memberName.starts_with(targetPrefix))
             {
-                BMCWEB_LOG_DEBUG << "\"" << satellite.first
-                                 << "\" is a known prefix";
+                BMCWEB_LOG_DEBUG("\"{}\" is a known prefix", satellite.first);
 
                 // Remove the known prefix from the request's URI and
                 // then forward to the associated satellite BMC
@@ -634,14 +631,14 @@
         }
 
         const crow::Request& thisReq = *sharedReq;
-        BMCWEB_LOG_DEBUG << "Aggregation is enabled, begin processing of "
-                         << thisReq.target();
+        BMCWEB_LOG_DEBUG("Aggregation is enabled, begin processing of {}",
+                         thisReq.target());
 
         // We previously determined the request is for a collection.  No need to
         // check again
         if (aggType == AggregationType::Collection)
         {
-            BMCWEB_LOG_DEBUG << "Aggregating a collection";
+            BMCWEB_LOG_DEBUG("Aggregating a collection");
             // We need to use a specific response handler and send the
             // request to all known satellites
             getInstance().forwardCollectionRequests(thisReq, asyncResp,
@@ -653,8 +650,8 @@
         // collection.  No need to check again
         if (aggType == AggregationType::ContainsSubordinate)
         {
-            BMCWEB_LOG_DEBUG
-                << "Aggregating what may have a subordinate collection";
+            BMCWEB_LOG_DEBUG(
+                "Aggregating what may have a subordinate collection");
             // We need to use a specific response handler and send the
             // request to all known satellites
             getInstance().forwardContainsSubordinateRequests(thisReq, asyncResp,
@@ -703,8 +700,7 @@
         {
             // Realistically this shouldn't get called since we perform an
             // earlier check to make sure the prefix exists
-            BMCWEB_LOG_ERROR << "Unrecognized satellite prefix \"" << prefix
-                             << "\"";
+            BMCWEB_LOG_ERROR("Unrecognized satellite prefix \"{}\"", prefix);
             return;
         }
 
@@ -714,8 +710,8 @@
         if (pos == std::string::npos)
         {
             // If this fails then something went wrong
-            BMCWEB_LOG_ERROR << "Error removing prefix \"" << prefix
-                             << "_\" from request URI";
+            BMCWEB_LOG_ERROR("Error removing prefix \"{}_\" from request URI",
+                             prefix);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -803,7 +799,7 @@
                  const std::unordered_map<std::string, boost::urls::url>&)>
             handler)
     {
-        BMCWEB_LOG_DEBUG << "Gathering satellite configs";
+        BMCWEB_LOG_DEBUG("Gathering satellite configs");
         sdbusplus::message::object_path path("/xyz/openbmc_project/inventory");
         dbus::utility::getManagedObjects(
             "xyz.openbmc_project.EntityManager", path,
@@ -813,8 +809,8 @@
             std::unordered_map<std::string, boost::urls::url> satelliteInfo;
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "DBUS response error " << ec.value() << ", "
-                                 << ec.message();
+                BMCWEB_LOG_ERROR("DBUS response error {}, {}", ec.value(),
+                                 ec.message());
                 handler(ec, satelliteInfo);
                 return;
             }
@@ -826,14 +822,14 @@
 
             if (!satelliteInfo.empty())
             {
-                BMCWEB_LOG_DEBUG << "Redfish Aggregation enabled with "
-                                 << std::to_string(satelliteInfo.size())
-                                 << " satellite BMCs";
+                BMCWEB_LOG_DEBUG(
+                    "Redfish Aggregation enabled with {} satellite BMCs",
+                    std::to_string(satelliteInfo.size()));
             }
             else
             {
-                BMCWEB_LOG_DEBUG
-                    << "No satellite BMCs detected.  Redfish Aggregation not enabled";
+                BMCWEB_LOG_DEBUG(
+                    "No satellite BMCs detected.  Redfish Aggregation not enabled");
             }
             handler(ec, satelliteInfo);
             });
@@ -866,21 +862,21 @@
                                                            false);
             if (jsonVal.is_discarded())
             {
-                BMCWEB_LOG_ERROR << "Error parsing satellite response as JSON";
+                BMCWEB_LOG_ERROR("Error parsing satellite response as JSON");
                 messages::operationFailed(asyncResp->res);
                 return;
             }
 
-            BMCWEB_LOG_DEBUG << "Successfully parsed satellite response";
+            BMCWEB_LOG_DEBUG("Successfully parsed satellite response");
 
             addPrefixes(jsonVal, prefix);
 
-            BMCWEB_LOG_DEBUG << "Added prefix to parsed satellite response";
+            BMCWEB_LOG_DEBUG("Added prefix to parsed satellite response");
 
             asyncResp->res.result(resp.result());
             asyncResp->res.jsonValue = std::move(jsonVal);
 
-            BMCWEB_LOG_DEBUG << "Finished writing asyncResp";
+            BMCWEB_LOG_DEBUG("Finished writing asyncResp");
         }
         else
         {
@@ -908,9 +904,9 @@
 
         if (resp.resultInt() != 200)
         {
-            BMCWEB_LOG_DEBUG
-                << "Collection resource does not exist in satellite BMC \""
-                << prefix << "\"";
+            BMCWEB_LOG_DEBUG(
+                "Collection resource does not exist in satellite BMC \"{}\"",
+                prefix);
             // Return the error if we haven't had any successes
             if (asyncResp->res.resultInt() != 200)
             {
@@ -930,7 +926,7 @@
                                                            false);
             if (jsonVal.is_discarded())
             {
-                BMCWEB_LOG_ERROR << "Error parsing satellite response as JSON";
+                BMCWEB_LOG_ERROR("Error parsing satellite response as JSON");
 
                 // Notify the user if doing so won't overwrite a valid response
                 if (asyncResp->res.resultInt() != 200)
@@ -940,13 +936,13 @@
                 return;
             }
 
-            BMCWEB_LOG_DEBUG << "Successfully parsed satellite response";
+            BMCWEB_LOG_DEBUG("Successfully parsed satellite response");
 
             // Now we need to add the prefix to the URIs contained in the
             // response.
             addPrefixes(jsonVal, prefix);
 
-            BMCWEB_LOG_DEBUG << "Added prefix to parsed satellite response";
+            BMCWEB_LOG_DEBUG("Added prefix to parsed satellite response");
 
             // If this resource collection does not exist on the aggregating bmc
             // and has not already been added from processing the response from
@@ -959,18 +955,18 @@
                 if ((!jsonVal.contains("Members")) &&
                     (!jsonVal["Members"].is_array()))
                 {
-                    BMCWEB_LOG_DEBUG
-                        << "Skipping aggregating unsupported resource";
+                    BMCWEB_LOG_DEBUG(
+                        "Skipping aggregating unsupported resource");
                     return;
                 }
 
-                BMCWEB_LOG_DEBUG
-                    << "Collection does not exist, overwriting asyncResp";
+                BMCWEB_LOG_DEBUG(
+                    "Collection does not exist, overwriting asyncResp");
                 asyncResp->res.result(resp.result());
                 asyncResp->res.jsonValue = std::move(jsonVal);
                 asyncResp->res.addHeader("Content-Type", "application/json");
 
-                BMCWEB_LOG_DEBUG << "Finished overwriting asyncResp";
+                BMCWEB_LOG_DEBUG("Finished overwriting asyncResp");
             }
             else
             {
@@ -980,13 +976,14 @@
                     (!asyncResp->res.jsonValue["Members"].is_array()))
 
                 {
-                    BMCWEB_LOG_DEBUG
-                        << "Skipping aggregating unsupported resource";
+                    BMCWEB_LOG_DEBUG(
+                        "Skipping aggregating unsupported resource");
                     return;
                 }
 
-                BMCWEB_LOG_DEBUG << "Adding aggregated resources from \""
-                                 << prefix << "\" to collection";
+                BMCWEB_LOG_DEBUG(
+                    "Adding aggregated resources from \"{}\" to collection",
+                    prefix);
 
                 // TODO: This is a potential race condition with multiple
                 // satellites and the aggregating bmc attempting to write to
@@ -1010,8 +1007,8 @@
         }
         else
         {
-            BMCWEB_LOG_ERROR << "Received unparsable response from \"" << prefix
-                             << "\"";
+            BMCWEB_LOG_ERROR("Received unparsable response from \"{}\"",
+                             prefix);
             // We received a response that was not a json.
             // Notify the user only if we did not receive any valid responses
             // and if the resource collection does not already exist on the
@@ -1041,9 +1038,9 @@
 
         if (resp.resultInt() != 200)
         {
-            BMCWEB_LOG_DEBUG
-                << "Resource uptree from Collection does not exist in "
-                << "satellite BMC \"" << prefix << "\"";
+            BMCWEB_LOG_DEBUG(
+                "Resource uptree from Collection does not exist in satellite BMC \"{}\"",
+                prefix);
             // Return the error if we haven't had any successes
             if (asyncResp->res.resultInt() != 200)
             {
@@ -1064,7 +1061,7 @@
                                                            false);
             if (jsonVal.is_discarded())
             {
-                BMCWEB_LOG_ERROR << "Error parsing satellite response as JSON";
+                BMCWEB_LOG_ERROR("Error parsing satellite response as JSON");
 
                 // Notify the user if doing so won't overwrite a valid response
                 if (asyncResp->res.resultInt() != 200)
@@ -1074,7 +1071,7 @@
                 return;
             }
 
-            BMCWEB_LOG_DEBUG << "Successfully parsed satellite response";
+            BMCWEB_LOG_DEBUG("Successfully parsed satellite response");
 
             // Parse response and add properties missing from the AsyncResp
             // Valid properties will be of the form <property>.@odata.id and
@@ -1085,7 +1082,7 @@
                 jsonVal.get_ptr<nlohmann::json::object_t*>();
             if (object == nullptr)
             {
-                BMCWEB_LOG_ERROR << "Parsed JSON was not an object?";
+                BMCWEB_LOG_ERROR("Parsed JSON was not an object?");
                 return;
             }
 
@@ -1100,7 +1097,7 @@
                     prop.second["@odata.id"].get_ptr<std::string*>();
                 if (strValue == nullptr)
                 {
-                    BMCWEB_LOG_CRITICAL << "Field wasn't a string????";
+                    BMCWEB_LOG_CRITICAL("Field wasn't a string????");
                     continue;
                 }
                 if (!searchCollectionsArray(*strValue, SearchType::CollOrCon))
@@ -1112,8 +1109,8 @@
                 if (!asyncResp->res.jsonValue.contains(prop.first))
                 {
                     // Only add the property if it did not already exist
-                    BMCWEB_LOG_DEBUG << "Adding link for " << *strValue
-                                     << " from BMC " << prefix;
+                    BMCWEB_LOG_DEBUG("Adding link for {} from BMC {}",
+                                     *strValue, prefix);
                     asyncResp->res.jsonValue[prop.first]["@odata.id"] =
                         *strValue;
                     continue;
@@ -1157,8 +1154,8 @@
         }
         else
         {
-            BMCWEB_LOG_ERROR << "Received unparsable response from \"" << prefix
-                             << "\"";
+            BMCWEB_LOG_ERROR("Received unparsable response from \"{}\"",
+                             prefix);
             // We received as response that was not a json
             // Notify the user only if we did not receive any valid responses,
             // and if the resource does not already exist on the aggregating BMC
@@ -1225,7 +1222,7 @@
                 // being a local resource describing the satellite
                 if (collectionItem.starts_with("5B247A_"))
                 {
-                    BMCWEB_LOG_DEBUG << "Need to forward a request";
+                    BMCWEB_LOG_DEBUG("Need to forward a request");
 
                     // Extract the prefix from the request's URI, retrieve the
                     // associated satellite config information, and then forward
@@ -1271,7 +1268,7 @@
             return Result::LocalHandle;
         }
 
-        BMCWEB_LOG_DEBUG << "Aggregation not required for " << url.buffer();
+        BMCWEB_LOG_DEBUG("Aggregation not required for {}", url.buffer());
         return Result::LocalHandle;
     }
 };
diff --git a/redfish-core/include/snmp_trap_event_clients.hpp b/redfish-core/include/snmp_trap_event_clients.hpp
index 08ff81b..de7bf9d 100644
--- a/redfish-core/include/snmp_trap_event_clients.hpp
+++ b/redfish-core/include/snmp_trap_event_clients.hpp
@@ -28,7 +28,7 @@
 {
     if (ec)
     {
-        BMCWEB_LOG_ERROR << "D-Bus response error on GetSubTree " << ec;
+        BMCWEB_LOG_ERROR("D-Bus response error on GetSubTree {}", ec);
         messages::internalError(asyncResp->res);
         return;
     }
@@ -95,8 +95,8 @@
                         dbus::utility::ManagedObjectType& resp) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "D-Bus response error on GetManagedObjects "
-                             << ec;
+            BMCWEB_LOG_ERROR("D-Bus response error on GetManagedObjects {}",
+                             ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -107,7 +107,7 @@
             const std::string snmpId = path.filename();
             if (snmpId.empty())
             {
-                BMCWEB_LOG_ERROR << "The SNMP client ID is wrong";
+                BMCWEB_LOG_ERROR("The SNMP client ID is wrong");
                 messages::internalError(asyncResp->res);
                 return;
             }
diff --git a/redfish-core/include/utils/chassis_utils.hpp b/redfish-core/include/utils/chassis_utils.hpp
index 9c7c7db..c8c203d 100644
--- a/redfish-core/include/utils/chassis_utils.hpp
+++ b/redfish-core/include/utils/chassis_utils.hpp
@@ -21,7 +21,7 @@
 void getValidChassisPath(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                          const std::string& chassisId, Callback&& callback)
 {
-    BMCWEB_LOG_DEBUG << "checkChassisId enter";
+    BMCWEB_LOG_DEBUG("checkChassisId enter");
     constexpr std::array<std::string_view, 2> interfaces = {
         "xyz.openbmc_project.Inventory.Item.Board",
         "xyz.openbmc_project.Inventory.Item.Chassis"};
@@ -33,11 +33,11 @@
          chassisId](const boost::system::error_code& ec,
                     const dbus::utility::MapperGetSubTreePathsResponse&
                         chassisPaths) mutable {
-        BMCWEB_LOG_DEBUG << "getValidChassisPath respHandler enter";
+        BMCWEB_LOG_DEBUG("getValidChassisPath respHandler enter");
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "getValidChassisPath respHandler DBUS error: "
-                             << ec;
+            BMCWEB_LOG_ERROR("getValidChassisPath respHandler DBUS error: {}",
+                             ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -49,7 +49,7 @@
             std::string chassisName = path.filename();
             if (chassisName.empty())
             {
-                BMCWEB_LOG_ERROR << "Failed to find '/' in " << chassis;
+                BMCWEB_LOG_ERROR("Failed to find '/' in {}", chassis);
                 continue;
             }
             if (chassisName == chassisId)
@@ -60,7 +60,7 @@
         }
         callback(chassisPath);
         });
-    BMCWEB_LOG_DEBUG << "checkChassisId exit";
+    BMCWEB_LOG_DEBUG("checkChassisId exit");
 }
 
 } // namespace chassis_utils
diff --git a/redfish-core/include/utils/collection.hpp b/redfish-core/include/utils/collection.hpp
index 500749c..862be90 100644
--- a/redfish-core/include/utils/collection.hpp
+++ b/redfish-core/include/utils/collection.hpp
@@ -37,8 +37,7 @@
                          std::span<const std::string_view> interfaces,
                          const char* subtree = "/xyz/openbmc_project/inventory")
 {
-    BMCWEB_LOG_DEBUG << "Get collection members for: "
-                     << collectionPath.buffer();
+    BMCWEB_LOG_DEBUG("Get collection members for: {}", collectionPath.buffer());
     dbus::utility::getSubTreePaths(
         subtree, 0, interfaces,
         [collectionPath, asyncResp{std::move(asyncResp)}](
@@ -53,7 +52,7 @@
 
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error " << ec.value();
+            BMCWEB_LOG_DEBUG("DBUS response error {}", ec.value());
             messages::internalError(asyncResp->res);
             return;
         }
diff --git a/redfish-core/include/utils/dbus_utils.hpp b/redfish-core/include/utils/dbus_utils.hpp
index 7e895fe..298a56b 100644
--- a/redfish-core/include/utils/dbus_utils.hpp
+++ b/redfish-core/include/utils/dbus_utils.hpp
@@ -14,11 +14,10 @@
     void operator()(const sdbusplus::UnpackErrorReason reason,
                     const std::string& property) const noexcept
     {
-        BMCWEB_LOG_ERROR
-            << "DBUS property error in property: " << property << ", reason: "
-            << static_cast<
-                   std::underlying_type_t<sdbusplus::UnpackErrorReason>>(
-                   reason);
+        BMCWEB_LOG_ERROR(
+            "DBUS property error in property: {}, reason: {}", property,
+            static_cast<std::underlying_type_t<sdbusplus::UnpackErrorReason>>(
+                reason));
     }
 };
 
diff --git a/redfish-core/include/utils/json_utils.hpp b/redfish-core/include/utils/json_utils.hpp
index 642ca80..3d3ae8d 100644
--- a/redfish-core/include/utils/json_utils.hpp
+++ b/redfish-core/include/utils/json_utils.hpp
@@ -101,21 +101,21 @@
 {
     if (from > std::numeric_limits<ToType>::max())
     {
-        BMCWEB_LOG_DEBUG << "Value for key " << key
-                         << " was greater than max: " << __PRETTY_FUNCTION__;
+        BMCWEB_LOG_DEBUG("Value for key {} was greater than max: {}", key,
+                         __PRETTY_FUNCTION__);
         return false;
     }
     if (from < std::numeric_limits<ToType>::lowest())
     {
-        BMCWEB_LOG_DEBUG << "Value for key " << key
-                         << " was less than min: " << __PRETTY_FUNCTION__;
+        BMCWEB_LOG_DEBUG("Value for key {} was less than min: {}", key,
+                         __PRETTY_FUNCTION__);
         return false;
     }
     if constexpr (std::is_floating_point_v<ToType>)
     {
         if (std::isnan(from))
         {
-            BMCWEB_LOG_DEBUG << "Value for key " << key << " was NAN";
+            BMCWEB_LOG_DEBUG("Value for key {} was NAN", key);
             return false;
         }
     }
@@ -193,9 +193,8 @@
         JsonType jsonPtr = jsonValue.get_ptr<JsonType>();
         if (jsonPtr == nullptr)
         {
-            BMCWEB_LOG_DEBUG
-                << "Value for key " << key
-                << " was incorrect type: " << jsonValue.type_name();
+            BMCWEB_LOG_DEBUG("Value for key {} was incorrect type: {}", key,
+                             jsonValue.type_name());
             return UnpackErrorCode::invalidType;
         }
         value = std::move(*jsonPtr);
@@ -392,7 +391,7 @@
         jsonRequest.get_ptr<nlohmann::json::object_t*>();
     if (obj == nullptr)
     {
-        BMCWEB_LOG_DEBUG << "Json value is not an object";
+        BMCWEB_LOG_DEBUG("Json value is not an object");
         messages::unrecognizedRequestBody(res);
         return false;
     }
@@ -521,14 +520,14 @@
     nlohmann::json jsonRequest;
     if (!json_util::processJsonFromRequest(res, req, jsonRequest))
     {
-        BMCWEB_LOG_DEBUG << "Json value not readable";
+        BMCWEB_LOG_DEBUG("Json value not readable");
         return std::nullopt;
     }
     nlohmann::json::object_t* object =
         jsonRequest.get_ptr<nlohmann::json::object_t*>();
     if (object == nullptr || object->empty())
     {
-        BMCWEB_LOG_DEBUG << "Json value is empty";
+        BMCWEB_LOG_DEBUG("Json value is empty");
         messages::emptyJSON(res);
         return std::nullopt;
     }
@@ -568,7 +567,7 @@
     nlohmann::json jsonRequest;
     if (!json_util::processJsonFromRequest(res, req, jsonRequest))
     {
-        BMCWEB_LOG_DEBUG << "Json value not readable";
+        BMCWEB_LOG_DEBUG("Json value not readable");
         return false;
     }
     return readJson(jsonRequest, res, key, std::forward<UnpackTypes&&>(in)...);
diff --git a/redfish-core/include/utils/pcie_util.hpp b/redfish-core/include/utils/pcie_util.hpp
index 4db6e03..a889f93 100644
--- a/redfish-core/include/utils/pcie_util.hpp
+++ b/redfish-core/include/utils/pcie_util.hpp
@@ -46,8 +46,7 @@
                               pcieDevicePaths) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "no PCIe device paths found ec: "
-                             << ec.message();
+            BMCWEB_LOG_DEBUG("no PCIe device paths found ec: {}", ec.message());
             // Not an error, system just doesn't have PCIe info
             return;
         }
diff --git a/redfish-core/include/utils/query_param.hpp b/redfish-core/include/utils/query_param.hpp
index 4ba521b..696e323 100644
--- a/redfish-core/include/utils/query_param.hpp
+++ b/redfish-core/include/utils/query_param.hpp
@@ -462,7 +462,7 @@
 inline bool processOnly(crow::App& app, crow::Response& res,
                         std::function<void(crow::Response&)>& completionHandler)
 {
-    BMCWEB_LOG_DEBUG << "Processing only query param";
+    BMCWEB_LOG_DEBUG("Processing only query param");
     auto itMembers = res.jsonValue.find("Members");
     if (itMembers == res.jsonValue.end())
     {
@@ -473,8 +473,9 @@
     auto itMemBegin = itMembers->begin();
     if (itMemBegin == itMembers->end() || itMembers->size() != 1)
     {
-        BMCWEB_LOG_DEBUG << "Members contains " << itMembers->size()
-                         << " element, returning full collection.";
+        BMCWEB_LOG_DEBUG(
+            "Members contains {} element, returning full collection.",
+            itMembers->size());
         completionHandler(res);
         return false;
     }
@@ -482,7 +483,7 @@
     auto itUrl = itMemBegin->find("@odata.id");
     if (itUrl == itMemBegin->end())
     {
-        BMCWEB_LOG_DEBUG << "No found odata.id";
+        BMCWEB_LOG_DEBUG("No found odata.id");
         messages::internalError(res);
         completionHandler(res);
         return false;
@@ -490,7 +491,7 @@
     const std::string* url = itUrl->get_ptr<const std::string*>();
     if (url == nullptr)
     {
-        BMCWEB_LOG_DEBUG << "@odata.id wasn't a string????";
+        BMCWEB_LOG_DEBUG("@odata.id wasn't a string????");
         messages::internalError(res);
         completionHandler(res);
         return false;
@@ -507,7 +508,8 @@
     }
 
     auto asyncResp = std::make_shared<bmcweb::AsyncResp>();
-    BMCWEB_LOG_DEBUG << "setting completion handler on " << &asyncResp->res;
+    BMCWEB_LOG_DEBUG("setting completion handler on {}",
+                     logPtr(&asyncResp->res));
     asyncResp->res.setCompleteRequestHandler(std::move(completionHandler));
     asyncResp->res.setIsAliveHelper(res.releaseIsAliveHelper());
     app.handle(newReq, asyncResp);
@@ -579,7 +581,7 @@
     for (auto& element : array)
     {
         nlohmann::json::json_pointer newPtr = jsonPtr / index;
-        BMCWEB_LOG_DEBUG << "Traversing response at " << newPtr.to_string();
+        BMCWEB_LOG_DEBUG("Traversing response at {}", newPtr.to_string());
         findNavigationReferencesRecursive(eType, element, newPtr, depth,
                                           skipDepth, inLinks, out);
         index++;
@@ -600,8 +602,7 @@
                 obj.begin()->second.get_ptr<const std::string*>();
             if (uri != nullptr)
             {
-                BMCWEB_LOG_DEBUG << "Found " << *uri << " at "
-                                 << jsonPtr.to_string();
+                BMCWEB_LOG_DEBUG("Found {} at {}", *uri, jsonPtr.to_string());
                 if (skipDepth == 0)
                 {
                     out.push_back({jsonPtr, *uri});
@@ -658,7 +659,7 @@
             continue;
         }
         nlohmann::json::json_pointer newPtr = jsonPtr / element.first;
-        BMCWEB_LOG_DEBUG << "Traversing response at " << newPtr;
+        BMCWEB_LOG_DEBUG("Traversing response at {}", newPtr);
 
         findNavigationReferencesRecursive(eType, element.second, newPtr,
                                           newDepth, skipDepth, localInLinks,
@@ -827,7 +828,7 @@
     void placeResult(const nlohmann::json::json_pointer& locationToPlace,
                      crow::Response& res)
     {
-        BMCWEB_LOG_DEBUG << "placeResult for " << locationToPlace;
+        BMCWEB_LOG_DEBUG("placeResult for {}", locationToPlace);
         propogateError(finalRes->res, res);
         if (!res.jsonValue.is_object() || res.jsonValue.empty())
         {
@@ -844,7 +845,7 @@
         std::vector<ExpandNode> nodes = findNavigationReferences(
             query.expandType, query.expandLevel, delegated.expandLevel,
             finalRes->res.jsonValue);
-        BMCWEB_LOG_DEBUG << nodes.size() << " nodes to traverse";
+        BMCWEB_LOG_DEBUG("{} nodes to traverse", nodes.size());
         const std::optional<std::string> queryStr = formatQueryForExpand(query);
         if (!queryStr)
         {
@@ -854,7 +855,7 @@
         for (const ExpandNode& node : nodes)
         {
             const std::string subQuery = node.uri + *queryStr;
-            BMCWEB_LOG_DEBUG << "URL of subquery:  " << subQuery;
+            BMCWEB_LOG_DEBUG("URL of subquery:  {}", subQuery);
             std::error_code ec;
             crow::Request newReq({boost::beast::http::verb::get, subQuery, 11},
                                  ec);
@@ -865,8 +866,8 @@
             }
 
             auto asyncResp = std::make_shared<bmcweb::AsyncResp>();
-            BMCWEB_LOG_DEBUG << "setting completion handler on "
-                             << &asyncResp->res;
+            BMCWEB_LOG_DEBUG("setting completion handler on {}",
+                             logPtr(&asyncResp->res));
 
             addAwaitingResponse(asyncResp, node.location);
             app.handle(newReq, asyncResp);
@@ -902,7 +903,7 @@
         return;
     }
 
-    BMCWEB_LOG_DEBUG << "Handling top/skip";
+    BMCWEB_LOG_DEBUG("Handling top/skip");
     nlohmann::json::object_t::iterator members = obj->find("Members");
     if (members == obj->end())
     {
@@ -946,12 +947,12 @@
         currRoot.get_ptr<nlohmann::json::object_t*>();
     if (object != nullptr)
     {
-        BMCWEB_LOG_DEBUG << "Current JSON is an object";
+        BMCWEB_LOG_DEBUG("Current JSON is an object");
         auto it = currRoot.begin();
         while (it != currRoot.end())
         {
             auto nextIt = std::next(it);
-            BMCWEB_LOG_DEBUG << "key=" << it.key();
+            BMCWEB_LOG_DEBUG("key={}", it.key());
             const SelectTrieNode* nextNode = currNode.find(it.key());
             // Per the Redfish spec section 7.3.3, the service shall select
             // certain properties as if $select was omitted. This applies to
@@ -969,12 +970,12 @@
             }
             if (nextNode != nullptr)
             {
-                BMCWEB_LOG_DEBUG << "Recursively select: " << it.key();
+                BMCWEB_LOG_DEBUG("Recursively select: {}", it.key());
                 recursiveSelect(*it, *nextNode);
                 it = nextIt;
                 continue;
             }
-            BMCWEB_LOG_DEBUG << it.key() << " is getting removed!";
+            BMCWEB_LOG_DEBUG("{} is getting removed!", it.key());
             it = currRoot.erase(it);
         }
     }
@@ -982,7 +983,7 @@
         currRoot.get_ptr<nlohmann::json::array_t*>();
     if (array != nullptr)
     {
-        BMCWEB_LOG_DEBUG << "Current JSON is an array";
+        BMCWEB_LOG_DEBUG("Current JSON is an array");
         // Array index is omitted, so reuse the same Trie node
         for (nlohmann::json& nextRoot : *array)
         {
@@ -1000,7 +1001,7 @@
 inline void processSelect(crow::Response& intermediateResponse,
                           const SelectTrieNode& trieRoot)
 {
-    BMCWEB_LOG_DEBUG << "Process $select quary parameter";
+    BMCWEB_LOG_DEBUG("Process $select quary parameter");
     recursiveSelect(intermediateResponse.jsonValue, trieRoot);
 }
 
@@ -1011,11 +1012,11 @@
 {
     if (!completionHandler)
     {
-        BMCWEB_LOG_DEBUG << "Function was invalid?";
+        BMCWEB_LOG_DEBUG("Function was invalid?");
         return;
     }
 
-    BMCWEB_LOG_DEBUG << "Processing query params";
+    BMCWEB_LOG_DEBUG("Processing query params");
     // If the request failed, there's no reason to even try to run query
     // params.
     if (intermediateResponse.resultInt() < 200 ||
@@ -1037,7 +1038,7 @@
 
     if (query.expandType != ExpandType::None)
     {
-        BMCWEB_LOG_DEBUG << "Executing expand query";
+        BMCWEB_LOG_DEBUG("Executing expand query");
         auto asyncResp = std::make_shared<bmcweb::AsyncResp>(
             std::move(intermediateResponse));
 
diff --git a/redfish-core/include/utils/sw_utils.hpp b/redfish-core/include/utils/sw_utils.hpp
index 176586f..cffc637 100644
--- a/redfish-core/include/utils/sw_utils.hpp
+++ b/redfish-core/include/utils/sw_utils.hpp
@@ -54,11 +54,11 @@
          populateLinkToImages](
             const boost::system::error_code& ec,
             const dbus::utility::MapperEndPoints& functionalSw) {
-        BMCWEB_LOG_DEBUG << "populateSoftwareInformation enter";
+        BMCWEB_LOG_DEBUG("populateSoftwareInformation enter");
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "error_code = " << ec;
-            BMCWEB_LOG_ERROR << "error msg = " << ec.message();
+            BMCWEB_LOG_ERROR("error_code = {}", ec);
+            BMCWEB_LOG_ERROR("error msg = {}", ec.message());
             messages::internalError(asyncResp->res);
             return;
         }
@@ -67,7 +67,7 @@
         {
             // Could keep going and try to populate SoftwareImages but
             // something is seriously wrong, so just fail
-            BMCWEB_LOG_ERROR << "Zero functional software in system";
+            BMCWEB_LOG_ERROR("Zero functional software in system");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -98,13 +98,13 @@
                 const dbus::utility::MapperGetSubTreeResponse& subtree) {
             if (ec2)
             {
-                BMCWEB_LOG_ERROR << "error_code = " << ec2;
-                BMCWEB_LOG_ERROR << "error msg = " << ec2.message();
+                BMCWEB_LOG_ERROR("error_code = {}", ec2);
+                BMCWEB_LOG_ERROR("error msg = {}", ec2.message());
                 messages::internalError(asyncResp->res);
                 return;
             }
 
-            BMCWEB_LOG_DEBUG << "Found " << subtree.size() << " images";
+            BMCWEB_LOG_DEBUG("Found {} images", subtree.size());
 
             for (const std::pair<std::string,
                                  std::vector<std::pair<
@@ -116,7 +116,7 @@
                 if (swId.empty())
                 {
                     messages::internalError(asyncResp->res);
-                    BMCWEB_LOG_ERROR << "Invalid software ID";
+                    BMCWEB_LOG_ERROR("Invalid software ID");
 
                     return;
                 }
@@ -142,8 +142,8 @@
                             propertiesList) {
                     if (ec3)
                     {
-                        BMCWEB_LOG_ERROR << "error_code = " << ec3;
-                        BMCWEB_LOG_ERROR << "error msg = " << ec3.message();
+                        BMCWEB_LOG_ERROR("error_code = {}", ec3);
+                        BMCWEB_LOG_ERROR("error msg = {}", ec3.message());
                         // Have seen the code update app delete the D-Bus
                         // object, during code update, between the call to
                         // mapper and here. Just leave these properties off if
@@ -185,9 +185,9 @@
                         return;
                     }
 
-                    BMCWEB_LOG_DEBUG << "Image ID: " << swId;
-                    BMCWEB_LOG_DEBUG << "Running image: " << runningImage;
-                    BMCWEB_LOG_DEBUG << "Image purpose: " << *swInvPurpose;
+                    BMCWEB_LOG_DEBUG("Image ID: {}", swId);
+                    BMCWEB_LOG_DEBUG("Running image: {}", runningImage);
+                    BMCWEB_LOG_DEBUG("Image purpose: {}", *swInvPurpose);
 
                     if (populateLinkToImages)
                     {
@@ -253,7 +253,7 @@
     {
         return resource::State::StandbySpare;
     }
-    BMCWEB_LOG_DEBUG << "Default sw state " << swState << " to Disabled";
+    BMCWEB_LOG_DEBUG("Default sw state {} to Disabled", swState);
     return resource::State::Disabled;
 }
 
@@ -277,7 +277,7 @@
     {
         return "OK";
     }
-    BMCWEB_LOG_DEBUG << "Sw state " << swState << " to Warning";
+    BMCWEB_LOG_DEBUG("Sw state {} to Warning", swState);
     return "Warning";
 }
 
@@ -297,7 +297,7 @@
                         const std::shared_ptr<std::string>& swId,
                         const std::string& dbusSvc)
 {
-    BMCWEB_LOG_DEBUG << "getSwStatus: swId " << *swId << " svc " << dbusSvc;
+    BMCWEB_LOG_DEBUG("getSwStatus: swId {} svc {}", *swId, dbusSvc);
 
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, dbusSvc,
@@ -331,7 +331,7 @@
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "getSwStatus: Activation " << *swInvActivation;
+        BMCWEB_LOG_DEBUG("getSwStatus: Activation {}", *swInvActivation);
         asyncResp->res.jsonValue["Status"]["State"] =
             getRedfishSwState(*swInvActivation);
         asyncResp->res.jsonValue["Status"]["Health"] =
@@ -359,8 +359,8 @@
                           const dbus::utility::MapperEndPoints& objPaths) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << " error_code = " << ec
-                             << " error msg =  " << ec.message();
+            BMCWEB_LOG_DEBUG(" error_code = {} error msg =  {}", ec,
+                             ec.message());
             // System can exist with no updateable software,
             // so don't throw error here.
             return;
diff --git a/redfish-core/include/utils/telemetry_utils.hpp b/redfish-core/include/utils/telemetry_utils.hpp
index 58ab1c9..33e31f0 100644
--- a/redfish-core/include/utils/telemetry_utils.hpp
+++ b/redfish-core/include/utils/telemetry_utils.hpp
@@ -71,9 +71,9 @@
 
         if (!parsed)
         {
-            BMCWEB_LOG_ERROR << "Failed to get chassis and sensor Node "
-                                "from "
-                             << uri;
+            BMCWEB_LOG_ERROR("Failed to get chassis and sensor Node "
+                             "from {}",
+                             uri);
             return std::make_optional<IncorrectMetricUri>({uri, uriIdx});
         }
 
@@ -101,9 +101,9 @@
             continue;
         }
 
-        BMCWEB_LOG_ERROR << "Failed to get chassis and sensor Node "
-                            "from "
-                         << uri;
+        BMCWEB_LOG_ERROR("Failed to get chassis and sensor Node "
+                         "from {}",
+                         uri);
         return std::make_optional<IncorrectMetricUri>({uri, uriIdx});
     }
     return std::nullopt;
diff --git a/redfish-core/include/utils/time_utils.hpp b/redfish-core/include/utils/time_utils.hpp
index 17c9111..314ea85 100644
--- a/redfish-core/include/utils/time_utils.hpp
+++ b/redfish-core/include/utils/time_utils.hpp
@@ -93,14 +93,13 @@
         auto [ptr, ec] = std::from_chars(v.begin(), v.end(), ticks);
         if (ec != std::errc())
         {
-            BMCWEB_LOG_ERROR << "Failed to convert string \"" << v
-                             << "\" to decimal";
+            BMCWEB_LOG_ERROR("Failed to convert string \"{}\" to decimal", v);
             return std::nullopt;
         }
         size_t charactersRead = static_cast<size_t>(ptr - v.data());
         if (ptr >= v.end())
         {
-            BMCWEB_LOG_ERROR << "Missing postfix";
+            BMCWEB_LOG_ERROR("Missing postfix");
             return std::nullopt;
         }
         if (*ptr == 'D')
@@ -147,8 +146,7 @@
             }
             else if (stage > ProcessingStage::Milliseconds)
             {
-                BMCWEB_LOG_ERROR
-                    << "Got unexpected information at end of parse";
+                BMCWEB_LOG_ERROR("Got unexpected information at end of parse");
                 return std::nullopt;
             }
             else
@@ -170,7 +168,7 @@
         }
         else
         {
-            BMCWEB_LOG_ERROR << "Unknown postfix " << *ptr;
+            BMCWEB_LOG_ERROR("Unknown postfix {}", *ptr);
             return std::nullopt;
         }
 
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index cb469bd..173de73 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -211,8 +211,8 @@
     // Both  Redfish and WebUI Account Types are needed to PATCH
     if (redfishType ^ webUIType)
     {
-        BMCWEB_LOG_ERROR
-            << "Missing Redfish or WebUI Account Type to set redfish User Group";
+        BMCWEB_LOG_ERROR(
+            "Missing Redfish or WebUI Account Type to set redfish User Group");
         messages::strictAccountTypes(res, "AccountTypes");
         return false;
     }
@@ -243,8 +243,8 @@
         (accountTypes.cend() ==
          std::find(accountTypes.cbegin(), accountTypes.cend(), "Redfish")))
     {
-        BMCWEB_LOG_ERROR
-            << "User disabling OWN Redfish Account Type is not allowed";
+        BMCWEB_LOG_ERROR(
+            "User disabling OWN Redfish Account Type is not allowed");
         messages::strictAccountTypes(asyncResp->res, "AccountTypes");
         return;
     }
@@ -264,7 +264,7 @@
         updatedUserGroups, [asyncResp](const boost::system::error_code& ec) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+                BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -342,8 +342,7 @@
     roleMapArray = nlohmann::json::array();
     for (const auto& obj : confData.groupRoleList)
     {
-        BMCWEB_LOG_DEBUG << "Pushing the data groupName="
-                         << obj.second.groupName << "\n";
+        BMCWEB_LOG_DEBUG("Pushing the data groupName={}", obj.second.groupName);
 
         nlohmann::json::object_t remoteGroup;
         remoteGroup["RemoteGroup"] = obj.second.groupName;
@@ -376,7 +375,7 @@
                      index](const boost::system::error_code& ec) {
                     if (ec)
                     {
-                        BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
+                        BMCWEB_LOG_ERROR("DBUS response error: {}", ec);
                         messages::internalError(asyncResp->res);
                         return;
                     }
@@ -388,7 +387,7 @@
             }
             else
             {
-                BMCWEB_LOG_ERROR << "Can't delete the object";
+                BMCWEB_LOG_ERROR("Can't delete the object");
                 messages::propertyValueTypeError(asyncResp->res, thisJson,
                                                  "RemoteRoleMapping/" +
                                                      std::to_string(index));
@@ -419,7 +418,7 @@
             // Update existing RoleMapping Object
             if (index < roleMapObjData.size())
             {
-                BMCWEB_LOG_DEBUG << "Update Role Map Object";
+                BMCWEB_LOG_DEBUG("Update Role Map Object");
                 // If "RemoteGroup" info is provided
                 if (remoteGroup)
                 {
@@ -439,8 +438,8 @@
                                  std::string_view(
                                      "xyz.openbmc_project.Common.Error.InvalidArgument")))
                             {
-                                BMCWEB_LOG_WARNING << "DBUS response error: "
-                                                   << ec;
+                                BMCWEB_LOG_WARNING("DBUS response error: {}",
+                                                   ec);
                                 messages::propertyValueIncorrect(asyncResp->res,
                                                                  "RemoteGroup",
                                                                  *remoteGroup);
@@ -474,8 +473,8 @@
                                  std::string_view(
                                      "xyz.openbmc_project.Common.Error.InvalidArgument")))
                             {
-                                BMCWEB_LOG_WARNING << "DBUS response error: "
-                                                   << ec;
+                                BMCWEB_LOG_WARNING("DBUS response error: {}",
+                                                   ec);
                                 messages::propertyValueIncorrect(
                                     asyncResp->res, "LocalRole", *localRole);
                                 return;
@@ -492,8 +491,8 @@
             // Create a new RoleMapping Object.
             else
             {
-                BMCWEB_LOG_DEBUG
-                    << "setRoleMappingProperties: Creating new Object";
+                BMCWEB_LOG_DEBUG(
+                    "setRoleMappingProperties: Creating new Object");
                 std::string pathString = "RemoteRoleMapping/" +
                                          std::to_string(index);
 
@@ -520,15 +519,15 @@
                     dbusObjectPath = ldapConfigObjectName;
                 }
 
-                BMCWEB_LOG_DEBUG << "Remote Group=" << *remoteGroup
-                                 << ",LocalRole=" << *localRole;
+                BMCWEB_LOG_DEBUG("Remote Group={},LocalRole={}", *remoteGroup,
+                                 *localRole);
 
                 crow::connections::systemBus->async_method_call(
                     [asyncResp, serverType, localRole,
                      remoteGroup](const boost::system::error_code& ec) {
                     if (ec)
                     {
-                        BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
+                        BMCWEB_LOG_ERROR("DBUS response error: {}", ec);
                         messages::internalError(asyncResp->res);
                         return;
                     }
@@ -565,8 +564,8 @@
                              const dbus::utility::MapperGetObject& resp) {
         if (ec || resp.empty())
         {
-            BMCWEB_LOG_ERROR
-                << "DBUS response error during getting of service name: " << ec;
+            BMCWEB_LOG_ERROR(
+                "DBUS response error during getting of service name: {}", ec);
             LDAPConfigData empty{};
             callback(false, empty, ldapType);
             return;
@@ -582,7 +581,7 @@
             if (ec2)
             {
                 callback(false, confData, ldapType);
-                BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec2;
+                BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec2);
                 return;
             }
 
@@ -603,8 +602,8 @@
             }
             else
             {
-                BMCWEB_LOG_ERROR << "Can't get the DbusType for the given type="
-                                 << ldapType;
+                BMCWEB_LOG_ERROR("Can't get the DbusType for the given type={}",
+                                 ldapType);
                 callback(false, confData, ldapType);
                 return;
             }
@@ -808,8 +807,8 @@
                  std::string_view(
                      "xyz.openbmc_project.Common.Error.InvalidArgument")))
             {
-                BMCWEB_LOG_WARNING
-                    << "Error Occurred in updating the service address";
+                BMCWEB_LOG_WARNING(
+                    "Error Occurred in updating the service address");
                 messages::propertyValueIncorrect(asyncResp->res,
                                                  "ServiceAddresses",
                                                  serviceAddressList.front());
@@ -827,7 +826,7 @@
             messages::propertyValueModified(asyncResp->res, "ServiceAddresses",
                                             serviceAddressList.front());
         }
-        BMCWEB_LOG_DEBUG << "Updated the service address";
+        BMCWEB_LOG_DEBUG("Updated the service address");
         });
 }
 /**
@@ -852,13 +851,13 @@
                                      const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "Error occurred in updating the username";
+            BMCWEB_LOG_DEBUG("Error occurred in updating the username");
             messages::internalError(asyncResp->res);
             return;
         }
         asyncResp->res.jsonValue[ldapServerElementName]["Authentication"]
                                 ["Username"] = username;
-        BMCWEB_LOG_DEBUG << "Updated the username";
+        BMCWEB_LOG_DEBUG("Updated the username");
     });
 }
 
@@ -883,13 +882,13 @@
                                      const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "Error occurred in updating the password";
+            BMCWEB_LOG_DEBUG("Error occurred in updating the password");
             messages::internalError(asyncResp->res);
             return;
         }
         asyncResp->res.jsonValue[ldapServerElementName]["Authentication"]
                                 ["Password"] = "";
-        BMCWEB_LOG_DEBUG << "Updated the password";
+        BMCWEB_LOG_DEBUG("Updated the password");
     });
 }
 
@@ -916,7 +915,7 @@
                                      const sdbusplus::message_t& msg) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "Error Occurred in Updating the base DN";
+            BMCWEB_LOG_DEBUG("Error Occurred in Updating the base DN");
             const sd_bus_error* dbusError = msg.get_error();
             if ((dbusError != nullptr) &&
                 (dbusError->name ==
@@ -941,7 +940,7 @@
             messages::propertyValueModified(
                 asyncResp->res, "BaseDistinguishedNames", baseDNList.front());
         }
-        BMCWEB_LOG_DEBUG << "Updated the base DN";
+        BMCWEB_LOG_DEBUG("Updated the base DN");
     });
 }
 /**
@@ -966,8 +965,8 @@
          ldapServerElementName](const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "Error Occurred in Updating the "
-                                "username attribute";
+            BMCWEB_LOG_DEBUG("Error Occurred in Updating the "
+                             "username attribute");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -975,7 +974,7 @@
         auto& searchSettingsJson =
             serverTypeJson["LDAPService"]["SearchSettings"];
         searchSettingsJson["UsernameAttribute"] = userNameAttribute;
-        BMCWEB_LOG_DEBUG << "Updated the user name attr.";
+        BMCWEB_LOG_DEBUG("Updated the user name attr.");
         });
 }
 /**
@@ -1000,8 +999,8 @@
          ldapServerElementName](const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "Error Occurred in Updating the "
-                                "groupname attribute";
+            BMCWEB_LOG_DEBUG("Error Occurred in Updating the "
+                             "groupname attribute");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -1009,7 +1008,7 @@
         auto& searchSettingsJson =
             serverTypeJson["LDAPService"]["SearchSettings"];
         searchSettingsJson["GroupsAttribute"] = groupsAttribute;
-        BMCWEB_LOG_DEBUG << "Updated the groupname attr";
+        BMCWEB_LOG_DEBUG("Updated the groupname attr");
         });
 }
 /**
@@ -1033,13 +1032,13 @@
          ldapServerElementName](const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "Error Occurred in Updating the service enable";
+            BMCWEB_LOG_DEBUG("Error Occurred in Updating the service enable");
             messages::internalError(asyncResp->res);
             return;
         }
         asyncResp->res.jsonValue[ldapServerElementName]["ServiceEnabled"] =
             serviceEnabled;
-        BMCWEB_LOG_DEBUG << "Updated Service enable = " << serviceEnabled;
+        BMCWEB_LOG_DEBUG("Updated Service enable = {}", serviceEnabled);
         });
 }
 
@@ -1057,7 +1056,7 @@
                              "Cookie", cookie, "SessionToken", sessionToken,
                              "XToken", xToken, "TLS", tls))
     {
-        BMCWEB_LOG_ERROR << "Cannot read values from AuthMethod tag";
+        BMCWEB_LOG_ERROR("Cannot read values from AuthMethod tag");
         return;
     }
 
@@ -1334,7 +1333,7 @@
                     // If password is invalid
                     messages::propertyValueFormatError(asyncResp->res,
                                                        *password, "Password");
-                    BMCWEB_LOG_ERROR << "pamUpdatePassword Failed";
+                    BMCWEB_LOG_ERROR("pamUpdatePassword Failed");
                 }
                 else if (retval != PAM_SUCCESS)
                 {
@@ -1356,7 +1355,7 @@
                     *enabled, [asyncResp](const boost::system::error_code& ec) {
                         if (ec)
                         {
-                            BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+                            BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
                             messages::internalError(asyncResp->res);
                             return;
                         }
@@ -1381,7 +1380,7 @@
                     priv, [asyncResp](const boost::system::error_code& ec) {
                         if (ec)
                         {
-                            BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+                            BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
                             messages::internalError(asyncResp->res);
                             return;
                         }
@@ -1409,7 +1408,7 @@
                     [asyncResp](const boost::system::error_code& ec) {
                 if (ec)
                 {
-                    BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+                    BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
                     messages::internalError(asyncResp->res);
                     return;
                 }
@@ -1506,8 +1505,8 @@
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "Got " << propertiesList.size()
-                         << "properties for AccountService";
+        BMCWEB_LOG_DEBUG("Got {}properties for AccountService",
+                         propertiesList.size());
 
         const uint8_t* minPasswordLength = nullptr;
         const uint32_t* accountUnlockTimeout = nullptr;
@@ -1737,7 +1736,7 @@
             if (user.empty())
             {
                 messages::internalError(asyncResp->res);
-                BMCWEB_LOG_ERROR << "Invalid firmware ID";
+                BMCWEB_LOG_ERROR("Invalid firmware ID");
 
                 return;
             }
@@ -1795,7 +1794,7 @@
             "xyz.openbmc_project.User.Manager", userPath,
             "xyz.openbmc_project.Object.Delete", "Delete");
 
-        BMCWEB_LOG_ERROR << "pamUpdatePassword Failed";
+        BMCWEB_LOG_ERROR("pamUpdatePassword Failed");
         return;
     }
 
@@ -1854,8 +1853,8 @@
         {
             if (!accountTypeUserGroups.empty())
             {
-                BMCWEB_LOG_ERROR
-                    << "Only administrator can get HostConsole access";
+                BMCWEB_LOG_ERROR(
+                    "Only administrator can get HostConsole access");
                 asyncResp->res.result(boost::beast::http::status::bad_request);
                 return;
             }
@@ -1921,7 +1920,7 @@
                        const std::vector<std::string>& allGroupsList) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "ERROR with async_method_call";
+            BMCWEB_LOG_DEBUG("ERROR with async_method_call");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -1988,7 +1987,7 @@
         if (!effectiveUserPrivileges.isSupersetOf(
                 requiredPermissionsToChangeNonSelf))
         {
-            BMCWEB_LOG_DEBUG << "GET Account denied access";
+            BMCWEB_LOG_DEBUG("GET Account denied access");
             messages::insufficientPrivilege(asyncResp->res);
             return;
         }
@@ -2039,7 +2038,7 @@
                             std::get_if<bool>(&property.second);
                         if (userEnabled == nullptr)
                         {
-                            BMCWEB_LOG_ERROR << "UserEnabled wasn't a bool";
+                            BMCWEB_LOG_ERROR("UserEnabled wasn't a bool");
                             messages::internalError(asyncResp->res);
                             return;
                         }
@@ -2051,9 +2050,9 @@
                             std::get_if<bool>(&property.second);
                         if (userLocked == nullptr)
                         {
-                            BMCWEB_LOG_ERROR << "UserLockedForF"
-                                                "ailedAttempt "
-                                                "wasn't a bool";
+                            BMCWEB_LOG_ERROR("UserLockedForF"
+                                             "ailedAttempt "
+                                             "wasn't a bool");
                             messages::internalError(asyncResp->res);
                             return;
                         }
@@ -2068,15 +2067,15 @@
                             std::get_if<std::string>(&property.second);
                         if (userPrivPtr == nullptr)
                         {
-                            BMCWEB_LOG_ERROR << "UserPrivilege wasn't a "
-                                                "string";
+                            BMCWEB_LOG_ERROR("UserPrivilege wasn't a "
+                                             "string");
                             messages::internalError(asyncResp->res);
                             return;
                         }
                         std::string role = getRoleIdFromPrivilege(*userPrivPtr);
                         if (role.empty())
                         {
-                            BMCWEB_LOG_ERROR << "Invalid user role";
+                            BMCWEB_LOG_ERROR("Invalid user role");
                             messages::internalError(asyncResp->res);
                             return;
                         }
@@ -2093,8 +2092,8 @@
                             std::get_if<bool>(&property.second);
                         if (userPasswordExpired == nullptr)
                         {
-                            BMCWEB_LOG_ERROR
-                                << "UserPasswordExpired wasn't a bool";
+                            BMCWEB_LOG_ERROR(
+                                "UserPasswordExpired wasn't a bool");
                             messages::internalError(asyncResp->res);
                             return;
                         }
@@ -2108,14 +2107,14 @@
                                 &property.second);
                         if (userGroups == nullptr)
                         {
-                            BMCWEB_LOG_ERROR
-                                << "userGroups wasn't a string vector";
+                            BMCWEB_LOG_ERROR(
+                                "userGroups wasn't a string vector");
                             messages::internalError(asyncResp->res);
                             return;
                         }
                         if (!translateUserGroup(*userGroups, asyncResp->res))
                         {
-                            BMCWEB_LOG_ERROR << "userGroups mapping failed";
+                            BMCWEB_LOG_ERROR("userGroups mapping failed");
                             messages::internalError(asyncResp->res);
                             return;
                         }
diff --git a/redfish-core/lib/aggregation_service.hpp b/redfish-core/lib/aggregation_service.hpp
index 6c93613..be1336b 100644
--- a/redfish-core/lib/aggregation_service.hpp
+++ b/redfish-core/lib/aggregation_service.hpp
@@ -210,8 +210,8 @@
         "</redfish/v1/JsonSchemas/AggregationService/AggregationSource.json>; rel=describedby");
 
     // Needed to prevent unused variable error
-    BMCWEB_LOG_DEBUG << "Added link header to response from "
-                     << aggregationSourceId;
+    BMCWEB_LOG_DEBUG("Added link header to response from {}",
+                     aggregationSourceId);
 }
 
 inline void requestRoutesAggregationSource(App& app)
diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
index b358b5f..8cd05d6 100644
--- a/redfish-core/lib/bios.hpp
+++ b/redfish-core/lib/bios.hpp
@@ -89,7 +89,7 @@
         [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "Failed to reset bios: " << ec;
+            BMCWEB_LOG_ERROR("Failed to reset bios: {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
diff --git a/redfish-core/lib/cable.hpp b/redfish-core/lib/cable.hpp
index 87e41d53..265a1ea 100644
--- a/redfish-core/lib/cable.hpp
+++ b/redfish-core/lib/cable.hpp
@@ -30,7 +30,7 @@
 {
     if (ec)
     {
-        BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+        BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
         messages::internalError(resp);
         return;
     }
@@ -83,7 +83,7 @@
                        const std::string& cableObjectPath,
                        const dbus::utility::MapperServiceMap& serviceMap)
 {
-    BMCWEB_LOG_DEBUG << "Get Properties for cable " << cableObjectPath;
+    BMCWEB_LOG_DEBUG("Get Properties for cable {}", cableObjectPath);
 
     for (const auto& [service, interfaces] : serviceMap)
     {
@@ -121,7 +121,7 @@
         {
             return;
         }
-        BMCWEB_LOG_DEBUG << "Cable Id: " << cableId;
+        BMCWEB_LOG_DEBUG("Cable Id: {}", cableId);
         constexpr std::array<std::string_view, 1> interfaces = {
             "xyz.openbmc_project.Inventory.Item.Cable"};
         dbus::utility::getSubTree(
@@ -137,7 +137,7 @@
 
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "DBUS response error " << ec;
+                BMCWEB_LOG_ERROR("DBUS response error {}", ec);
                 messages::internalError(asyncResp->res);
                 return;
             }
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index 62704c9..0073bc9 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -70,7 +70,7 @@
                                   certificate, "CertificateType",
                                   certificateType))
     {
-        BMCWEB_LOG_ERROR << "Required parameters are missing";
+        BMCWEB_LOG_ERROR("Required parameters are missing");
         messages::internalError(asyncResp->res);
         return {};
     }
@@ -111,22 +111,22 @@
                                                    std::ofstream::trunc);
             out << certString;
             out.close();
-            BMCWEB_LOG_DEBUG << "Creating certificate file"
-                             << certificateFile.string();
+            BMCWEB_LOG_DEBUG("Creating certificate file{}",
+                             certificateFile.string());
         }
     }
     ~CertificateFile()
     {
         if (std::filesystem::exists(certDirectory))
         {
-            BMCWEB_LOG_DEBUG << "Removing certificate file"
-                             << certificateFile.string();
+            BMCWEB_LOG_DEBUG("Removing certificate file{}",
+                             certificateFile.string());
             std::error_code ec;
             std::filesystem::remove_all(certDirectory, ec);
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "Failed to remove temp directory"
-                                 << certDirectory.string();
+                BMCWEB_LOG_ERROR("Failed to remove temp directory{}",
+                                 certDirectory.string());
             }
         }
     }
@@ -228,7 +228,7 @@
             const dbus::utility::MapperGetSubTreePathsResponse& certPaths) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "Certificate collection query failed: " << ec;
+            BMCWEB_LOG_ERROR("Certificate collection query failed: {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -241,7 +241,7 @@
             std::string certId = objPath.filename();
             if (certId.empty())
             {
-                BMCWEB_LOG_ERROR << "Invalid certificate objPath " << certPath;
+                BMCWEB_LOG_ERROR("Invalid certificate objPath {}", certPath);
                 continue;
             }
 
@@ -294,8 +294,8 @@
     const std::string& certId, const boost::urls::url& certURL,
     const std::string& name)
 {
-    BMCWEB_LOG_DEBUG << "getCertificateProperties Path=" << objectPath
-                     << " certId=" << certId << " certURl=" << certURL;
+    BMCWEB_LOG_DEBUG("getCertificateProperties Path={} certId={} certURl={}",
+                     objectPath, certId, certURL);
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, service, objectPath, certs::certPropIntf,
         [asyncResp, certURL, certId,
@@ -303,7 +303,7 @@
                const dbus::utility::DBusPropertiesMap& properties) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
+            BMCWEB_LOG_ERROR("DBUS response error: {}", ec);
             messages::resourceNotFound(asyncResp->res, "Certificate", certId);
             return;
         }
@@ -389,7 +389,7 @@
             messages::resourceNotFound(asyncResp->res, "Certificate", id);
             return;
         }
-        BMCWEB_LOG_INFO << "Certificate deleted";
+        BMCWEB_LOG_INFO("Certificate deleted");
         asyncResp->res.result(boost::beast::http::status::no_content);
         },
         service, objectPath, certs::objDeleteIntf, "Delete");
@@ -479,7 +479,7 @@
                                    certificateUri, "CertificateType",
                                    certificateType))
     {
-        BMCWEB_LOG_ERROR << "Required parameters are missing";
+        BMCWEB_LOG_ERROR("Required parameters are missing");
         return;
     }
 
@@ -503,7 +503,7 @@
                                          "CertificateUri");
         return;
     }
-    BMCWEB_LOG_INFO << "Certificate URI to replace: " << certURI;
+    BMCWEB_LOG_INFO("Certificate URI to replace: {}", certURI);
 
     boost::urls::result<boost::urls::url_view> parsedUrl =
         boost::urls::parse_relative_ref(certURI);
@@ -559,7 +559,7 @@
          name](const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
+            BMCWEB_LOG_ERROR("DBUS response error: {}", ec);
             if (ec.value() ==
                 boost::system::linux_error::bad_request_descriptor)
             {
@@ -570,8 +570,8 @@
             return;
         }
         getCertificateProperties(asyncResp, objectPath, service, id, url, name);
-        BMCWEB_LOG_DEBUG << "HTTPS certificate install file="
-                         << certFile->getCertFilePath();
+        BMCWEB_LOG_DEBUG("HTTPS certificate install file={}",
+                         certFile->getCertFilePath());
         },
         service, objectPath, certs::certReplaceIntf, "Replace",
         certFile->getCertFilePath());
@@ -594,21 +594,20 @@
                    const std::string& certObjPath,
                    const std::string& csrObjPath)
 {
-    BMCWEB_LOG_DEBUG << "getCSR CertObjectPath" << certObjPath
-                     << " CSRObjectPath=" << csrObjPath
-                     << " service=" << service;
+    BMCWEB_LOG_DEBUG("getCSR CertObjectPath{} CSRObjectPath={} service={}",
+                     certObjPath, csrObjPath, service);
     crow::connections::systemBus->async_method_call(
         [asyncResp, certURI](const boost::system::error_code& ec,
                              const std::string& csr) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
+            BMCWEB_LOG_ERROR("DBUS response error: {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
         if (csr.empty())
         {
-            BMCWEB_LOG_ERROR << "CSR read is empty";
+            BMCWEB_LOG_ERROR("CSR read is empty");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -793,16 +792,16 @@
             // before completion.
             if (ec != boost::asio::error::operation_aborted)
             {
-                BMCWEB_LOG_ERROR << "Async_wait failed " << ec;
+                BMCWEB_LOG_ERROR("Async_wait failed {}", ec);
             }
             return;
         }
-        BMCWEB_LOG_ERROR << "Timed out waiting for Generating CSR";
+        BMCWEB_LOG_ERROR("Timed out waiting for Generating CSR");
         messages::internalError(asyncResp->res);
     });
 
     // create a matcher to wait on CSR object
-    BMCWEB_LOG_DEBUG << "create matcher with path " << objectPath;
+    BMCWEB_LOG_DEBUG("create matcher with path {}", objectPath);
     std::string match("type='signal',"
                       "interface='org.freedesktop.DBus.ObjectManager',"
                       "path='" +
@@ -815,7 +814,7 @@
         timeout.cancel();
         if (m.is_method_error())
         {
-            BMCWEB_LOG_ERROR << "Dbus method error!!!";
+            BMCWEB_LOG_ERROR("Dbus method error!!!");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -824,7 +823,7 @@
 
         sdbusplus::message::object_path csrObjectPath;
         m.read(csrObjectPath, interfacesProperties);
-        BMCWEB_LOG_DEBUG << "CSR object added" << csrObjectPath.str;
+        BMCWEB_LOG_DEBUG("CSR object added{}", csrObjectPath.str);
         for (const auto& interface : interfacesProperties)
         {
             if (interface.first == "xyz.openbmc_project.Certs.CSR")
@@ -839,7 +838,7 @@
         [asyncResp](const boost::system::error_code& ec, const std::string&) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "DBUS response error: " << ec.message();
+            BMCWEB_LOG_ERROR("DBUS response error: {}", ec.message());
             messages::internalError(asyncResp->res);
             return;
         }
@@ -909,7 +908,7 @@
     {
         return;
     }
-    BMCWEB_LOG_DEBUG << "HTTPSCertificateCollection::doPost";
+    BMCWEB_LOG_DEBUG("HTTPSCertificateCollection::doPost");
 
     asyncResp->res.jsonValue["Name"] = "HTTPS Certificate";
     asyncResp->res.jsonValue["Description"] = "HTTPS Certificate";
@@ -918,7 +917,7 @@
 
     if (certFileBody.empty())
     {
-        BMCWEB_LOG_ERROR << "Cannot get certificate from request body.";
+        BMCWEB_LOG_ERROR("Cannot get certificate from request body.");
         messages::unrecognizedRequestBody(asyncResp->res);
         return;
     }
@@ -931,7 +930,7 @@
                               const std::string& objectPath) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
+            BMCWEB_LOG_ERROR("DBUS response error: {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -943,8 +942,8 @@
             certId);
         getCertificateProperties(asyncResp, objectPath, certs::httpsServiceName,
                                  certId, certURL, "HTTPS Certificate");
-        BMCWEB_LOG_DEBUG << "HTTPS certificate install file="
-                         << certFile->getCertFilePath();
+        BMCWEB_LOG_DEBUG("HTTPS certificate install file={}",
+                         certFile->getCertFilePath());
         },
         certs::httpsServiceName, certs::httpsObjectPath, certs::certInstallIntf,
         "Install", certFile->getCertFilePath());
@@ -959,7 +958,7 @@
         return;
     }
 
-    BMCWEB_LOG_DEBUG << "HTTPS Certificate ID=" << id;
+    BMCWEB_LOG_DEBUG("HTTPS Certificate ID={}", id);
     const boost::urls::url certURL = boost::urls::format(
         "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/{}", id);
     std::string objPath =
@@ -1024,7 +1023,7 @@
 
     if (certFileBody.empty())
     {
-        BMCWEB_LOG_ERROR << "Cannot get certificate from request body.";
+        BMCWEB_LOG_ERROR("Cannot get certificate from request body.");
         messages::unrecognizedRequestBody(asyncResp->res);
         return;
     }
@@ -1037,7 +1036,7 @@
                               const std::string& objectPath) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
+            BMCWEB_LOG_ERROR("DBUS response error: {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -1048,8 +1047,8 @@
             "/redfish/v1/AccountService/LDAP/Certificates/{}", certId);
         getCertificateProperties(asyncResp, objectPath, certs::ldapServiceName,
                                  certId, certURL, "LDAP Certificate");
-        BMCWEB_LOG_DEBUG << "LDAP certificate install file="
-                         << certFile->getCertFilePath();
+        BMCWEB_LOG_DEBUG("LDAP certificate install file={}",
+                         certFile->getCertFilePath());
         },
         certs::ldapServiceName, certs::ldapObjectPath, certs::certInstallIntf,
         "Install", certFile->getCertFilePath());
@@ -1064,7 +1063,7 @@
         return;
     }
 
-    BMCWEB_LOG_DEBUG << "LDAP Certificate ID=" << id;
+    BMCWEB_LOG_DEBUG("LDAP Certificate ID={}", id);
     const boost::urls::url certURL = boost::urls::format(
         "/redfish/v1/AccountService/LDAP/Certificates/{}", id);
     std::string objPath =
@@ -1082,7 +1081,7 @@
         return;
     }
 
-    BMCWEB_LOG_DEBUG << "Delete LDAP Certificate ID=" << id;
+    BMCWEB_LOG_DEBUG("Delete LDAP Certificate ID={}", id);
     std::string objPath =
         sdbusplus::message::object_path(certs::ldapObjectPath) / id;
 
@@ -1146,7 +1145,7 @@
 
     if (certFileBody.empty())
     {
-        BMCWEB_LOG_ERROR << "Cannot get certificate from request body.";
+        BMCWEB_LOG_ERROR("Cannot get certificate from request body.");
         messages::unrecognizedRequestBody(asyncResp->res);
         return;
     }
@@ -1158,7 +1157,7 @@
                               const std::string& objectPath) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
+            BMCWEB_LOG_ERROR("DBUS response error: {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -1170,8 +1169,8 @@
         getCertificateProperties(asyncResp, objectPath,
                                  certs::authorityServiceName, certId, certURL,
                                  "TrustStore Certificate");
-        BMCWEB_LOG_DEBUG << "TrustStore certificate install file="
-                         << certFile->getCertFilePath();
+        BMCWEB_LOG_DEBUG("TrustStore certificate install file={}",
+                         certFile->getCertFilePath());
         },
         certs::authorityServiceName, certs::authorityObjectPath,
         certs::certInstallIntf, "Install", certFile->getCertFilePath());
@@ -1186,7 +1185,7 @@
         return;
     }
 
-    BMCWEB_LOG_DEBUG << "Truststore Certificate ID=" << id;
+    BMCWEB_LOG_DEBUG("Truststore Certificate ID={}", id);
     const boost::urls::url certURL = boost::urls::format(
         "/redfish/v1/Managers/bmc/Truststore/Certificates/{}", id);
     std::string objPath =
@@ -1204,7 +1203,7 @@
         return;
     }
 
-    BMCWEB_LOG_DEBUG << "Delete TrustStore Certificate ID=" << id;
+    BMCWEB_LOG_DEBUG("Delete TrustStore Certificate ID={}", id);
     std::string objPath =
         sdbusplus::message::object_path(certs::authorityObjectPath) / id;
 
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index fc89d03..fbab894 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -62,7 +62,7 @@
                     const std::vector<std::string>& storageList) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "getStorageLink got DBUS response error";
+            BMCWEB_LOG_DEBUG("getStorageLink got DBUS response error");
             return;
         }
 
@@ -109,15 +109,15 @@
             {
                 // Service not available, no error, just don't return
                 // chassis state info
-                BMCWEB_LOG_DEBUG << "Service not available " << ec;
+                BMCWEB_LOG_DEBUG("Service not available {}", ec);
                 return;
             }
-            BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+            BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "Chassis state: " << chassisState;
+        BMCWEB_LOG_DEBUG("Chassis state: {}", chassisState);
         // Verify Chassis State
         if (chassisState == "xyz.openbmc_project.State.Chassis.PowerState.On")
         {
@@ -137,7 +137,7 @@
                                   const std::string& service,
                                   const std::string& objPath)
 {
-    BMCWEB_LOG_DEBUG << "Get intrusion status by service \n";
+    BMCWEB_LOG_DEBUG("Get intrusion status by service ");
 
     sdbusplus::asio::getProperty<std::string>(
         *crow::connections::systemBus, service, objPath,
@@ -148,7 +148,7 @@
         {
             // do not add err msg in redfish response, because this is not
             //     mandatory property
-            BMCWEB_LOG_ERROR << "DBUS response error " << ec << "\n";
+            BMCWEB_LOG_ERROR("DBUS response error {}", ec);
             return;
         }
 
@@ -175,7 +175,7 @@
         {
             // do not add err msg in redfish response, because this is not
             //     mandatory property
-            BMCWEB_LOG_INFO << "DBUS error: no matched iface " << ec << "\n";
+            BMCWEB_LOG_INFO("DBUS error: no matched iface {}", ec);
             return;
         }
         // Iterate over all retrieved ObjectPaths.
@@ -220,7 +220,7 @@
     {
         if (ec.value() != EBADR)
         {
-            BMCWEB_LOG_ERROR << "DBUS response error " << ec;
+            BMCWEB_LOG_ERROR("DBUS response error {}", ec);
             messages::internalError(asyncResp->res);
         }
         return;
@@ -231,7 +231,7 @@
     }
     if (upstreamChassisPaths.size() > 1)
     {
-        BMCWEB_LOG_ERROR << chassisId << " is contained by mutliple chassis";
+        BMCWEB_LOG_ERROR("{} is contained by mutliple chassis", chassisId);
         messages::internalError(asyncResp->res);
         return;
     }
@@ -241,8 +241,8 @@
     std::string upstreamChassis = upstreamChassisPath.filename();
     if (upstreamChassis.empty())
     {
-        BMCWEB_LOG_WARNING << "Malformed upstream Chassis path "
-                           << upstreamChassisPath.str << " on " << chassisId;
+        BMCWEB_LOG_WARNING("Malformed upstream Chassis path {} on {}",
+                           upstreamChassisPath.str, chassisId);
         return;
     }
 
@@ -259,7 +259,7 @@
     {
         if (ec.value() != EBADR)
         {
-            BMCWEB_LOG_ERROR << "DBUS response error " << ec;
+            BMCWEB_LOG_ERROR("DBUS response error {}", ec);
             messages::internalError(asyncResp->res);
         }
         return;
@@ -280,9 +280,8 @@
         std::string downstreamChassis = downstreamChassisPath.filename();
         if (downstreamChassis.empty())
         {
-            BMCWEB_LOG_WARNING << "Malformed downstream Chassis path "
-                               << downstreamChassisPath.str << " on "
-                               << chassisId;
+            BMCWEB_LOG_WARNING("Malformed downstream Chassis path {} on {}",
+                               downstreamChassisPath.str, chassisId);
             continue;
         }
         nlohmann::json link;
@@ -298,7 +297,7 @@
                            const std::string& chassisId,
                            const std::string& chassisPath)
 {
-    BMCWEB_LOG_DEBUG << "Get chassis connectivity";
+    BMCWEB_LOG_DEBUG("Get chassis connectivity");
 
     dbus::utility::getAssociationEndPoints(
         chassisPath + "/contained_by",
@@ -333,7 +332,7 @@
                     const std::string& property) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "DBUS response error for Location";
+            BMCWEB_LOG_ERROR("DBUS response error for Location");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -354,7 +353,7 @@
                     const std::string& chassisUUID) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "DBUS response error for UUID";
+            BMCWEB_LOG_ERROR("DBUS response error for UUID");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -382,7 +381,7 @@
             const dbus::utility::MapperGetSubTreeResponse& subtree) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "DBUS response error " << ec;
+            BMCWEB_LOG_ERROR("DBUS response error {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -424,7 +423,7 @@
 
             if (connectionNames.empty())
             {
-                BMCWEB_LOG_ERROR << "Got 0 Connection names";
+                BMCWEB_LOG_ERROR("Got 0 Connection names");
                 continue;
             }
 
@@ -484,8 +483,8 @@
                                     const std::string& property) {
                         if (ec2)
                         {
-                            BMCWEB_LOG_ERROR
-                                << "DBus response error for AssetTag: " << ec2;
+                            BMCWEB_LOG_ERROR(
+                                "DBus response error for AssetTag: {}", ec2);
                             messages::internalError(asyncResp->res);
                             return;
                         }
@@ -502,9 +501,9 @@
                                     const bool property) {
                         if (ec2)
                         {
-                            BMCWEB_LOG_ERROR
-                                << "DBus response error for HotPluggable: "
-                                << ec2;
+                            BMCWEB_LOG_ERROR(
+                                "DBus response error for HotPluggable: {}",
+                                ec2);
                             messages::internalError(asyncResp->res);
                             return;
                         }
@@ -693,7 +692,7 @@
                        const dbus::utility::MapperGetSubTreeResponse& subtree) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "DBUS response error " << ec;
+            BMCWEB_LOG_ERROR("DBUS response error {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -716,7 +715,7 @@
 
             if (connectionNames.empty())
             {
-                BMCWEB_LOG_ERROR << "Got 0 Connection names";
+                BMCWEB_LOG_ERROR("Got 0 Connection names");
                 continue;
             }
 
@@ -793,7 +792,7 @@
 {
     if (eMsg.get_error() == nullptr)
     {
-        BMCWEB_LOG_ERROR << "D-Bus response error: " << ec;
+        BMCWEB_LOG_ERROR("D-Bus response error: {}", ec);
         messages::internalError(res);
         return;
     }
@@ -804,13 +803,13 @@
     if (errorMessage ==
         std::string_view("xyz.openbmc_project.State.Chassis.Error.BMCNotReady"))
     {
-        BMCWEB_LOG_DEBUG << "BMC not ready, operation not allowed right now";
+        BMCWEB_LOG_DEBUG("BMC not ready, operation not allowed right now");
         messages::serviceTemporarilyUnavailable(res, "10");
         return;
     }
 
-    BMCWEB_LOG_ERROR << "Chassis Power Cycle fail " << ec
-                     << " sdbusplus:" << errorMessage;
+    BMCWEB_LOG_ERROR("Chassis Power Cycle fail {} sdbusplus:{}", ec,
+                     errorMessage);
     messages::internalError(res);
 }
 
@@ -828,7 +827,7 @@
             const dbus::utility::MapperGetSubTreePathsResponse& chassisList) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "[mapper] Bad D-Bus request error: " << ec;
+            BMCWEB_LOG_ERROR("[mapper] Bad D-Bus request error: {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -877,7 +876,7 @@
     {
         return;
     }
-    BMCWEB_LOG_DEBUG << "Post Chassis Reset.";
+    BMCWEB_LOG_DEBUG("Post Chassis Reset.");
 
     std::string resetType;
 
@@ -888,8 +887,7 @@
 
     if (resetType != "PowerCycle")
     {
-        BMCWEB_LOG_DEBUG << "Invalid property value for ResetType: "
-                         << resetType;
+        BMCWEB_LOG_DEBUG("Invalid property value for ResetType: {}", resetType);
         messages::actionParameterNotSupported(asyncResp->res, resetType,
                                               "ResetType");
 
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 36873b9..218affe 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -499,9 +499,9 @@
                         }
                         else
                         {
-                            BMCWEB_LOG_ERROR
-                                << "Got extra property: " << property.first
-                                << " on the " << objpath.first.str << " object";
+                            BMCWEB_LOG_ERROR(
+                                "Got extra property: {} on the {} object",
+                                property.first, objpath.first.str);
                         }
                     }
                 }
@@ -593,9 +593,9 @@
                         }
                         else
                         {
-                            BMCWEB_LOG_ERROR
-                                << "Got extra property: " << property.first
-                                << " on the " << objpath.first.str << " object";
+                            BMCWEB_LOG_ERROR(
+                                "Got extra property: {} on the {} object",
+                                property.first, objpath.first.str);
                         }
                     }
                     // Check if given address is local, or global
@@ -1047,7 +1047,7 @@
         [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+            BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -1066,7 +1066,7 @@
         [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+            BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -1076,7 +1076,7 @@
 inline void setDHCPv4Config(const std::string& propertyName, const bool& value,
                             const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
-    BMCWEB_LOG_DEBUG << propertyName << " = " << value;
+    BMCWEB_LOG_DEBUG("{} = {}", propertyName, value);
     sdbusplus::asio::setProperty(
         *crow::connections::systemBus, "xyz.openbmc_project.Network",
         "/xyz/openbmc_project/network/dhcp",
@@ -1084,7 +1084,7 @@
         [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+            BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -1191,14 +1191,14 @@
         nextUseDomain = ethData.hostNameEnabled;
     }
 
-    BMCWEB_LOG_DEBUG << "set DHCPEnabled...";
+    BMCWEB_LOG_DEBUG("set DHCPEnabled...");
     setDHCPEnabled(ifaceId, "DHCPEnabled", nextv4DHCPState, nextv6DHCPState,
                    asyncResp);
-    BMCWEB_LOG_DEBUG << "set DNSEnabled...";
+    BMCWEB_LOG_DEBUG("set DNSEnabled...");
     setDHCPv4Config("DNSEnabled", nextDNS, asyncResp);
-    BMCWEB_LOG_DEBUG << "set NTPEnabled...";
+    BMCWEB_LOG_DEBUG("set NTPEnabled...");
     setDHCPv4Config("NTPEnabled", nextNTP, asyncResp);
-    BMCWEB_LOG_DEBUG << "set HostNameEnabled...";
+    BMCWEB_LOG_DEBUG("set HostNameEnabled...");
     setDHCPv4Config("HostNameEnabled", nextUseDomain, asyncResp);
 }
 
@@ -1707,7 +1707,7 @@
         messages::internalError(asyncResp->res);
         return;
     }
-    BMCWEB_LOG_DEBUG << "DBus error: " << dbusError->name;
+    BMCWEB_LOG_DEBUG("DBus error: {}", dbusError->name);
 
     if (std::string_view("org.freedesktop.DBus.Error.UnknownObject") ==
         dbusError->name)
@@ -1741,7 +1741,7 @@
             messages::internalError(asyncResp->res);
             return;
         }
-        BMCWEB_LOG_DEBUG << "DBus error: " << dbusError->name;
+        BMCWEB_LOG_DEBUG("DBus error: {}", dbusError->name);
 
         if (std::string_view(
                 "xyz.openbmc_project.Common.Error.ResourceNotFound") ==
@@ -1856,7 +1856,7 @@
                                       "Links/RelatedInterfaces/0/@odata.id");
             return;
         }
-        BMCWEB_LOG_INFO << "Parent Interface URI: " << parentInterfaceUri;
+        BMCWEB_LOG_INFO("Parent Interface URI: {}", parentInterfaceUri);
 
         boost::urls::result<boost::urls::url_view> parsedUri =
             boost::urls::parse_relative_ref(parentInterfaceUri);
diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp
index 4919dec..35e3a1c 100644
--- a/redfish-core/lib/event_service.hpp
+++ b/redfish-core/lib/event_service.hpp
@@ -198,7 +198,7 @@
             return;
         }
 
-        BMCWEB_LOG_ERROR << "D-Bus response error on GetManagedObjects " << ec;
+        BMCWEB_LOG_ERROR("D-Bus response error on GetManagedObjects {}", ec);
         messages::internalError(asyncResp->res);
         return;
     }
@@ -209,7 +209,7 @@
         const std::string snmpId = path.filename();
         if (snmpId.empty())
         {
-            BMCWEB_LOG_ERROR << "The SNMP client ID is wrong";
+            BMCWEB_LOG_ERROR("The SNMP client ID is wrong");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -324,8 +324,7 @@
         if (!crow::utility::validateAndSplitUrl(destUrl, urlProto, host, port,
                                                 path))
         {
-            BMCWEB_LOG_WARNING
-                << "Failed to validate and split destination url";
+            BMCWEB_LOG_WARNING("Failed to validate and split destination url");
             messages::propertyValueFormatError(asyncResp->res, destUrl,
                                                "Destination");
             return;
diff --git a/redfish-core/lib/eventservice_sse.hpp b/redfish-core/lib/eventservice_sse.hpp
index 864383c..4ad29a6 100644
--- a/redfish-core/lib/eventservice_sse.hpp
+++ b/redfish-core/lib/eventservice_sse.hpp
@@ -13,7 +13,7 @@
     if ((manager.getNumberOfSubscriptions() >= maxNoOfSubscriptions) ||
         manager.getNumberOfSSESubscriptions() >= maxNoOfSSESubscriptions)
     {
-        BMCWEB_LOG_WARNING << "Max SSE subscriptions reached";
+        BMCWEB_LOG_WARNING("Max SSE subscriptions reached");
         conn.close("Max SSE subscriptions reached");
         return;
     }
diff --git a/redfish-core/lib/fabric_adapters.hpp b/redfish-core/lib/fabric_adapters.hpp
index d3119d3..2a85f42 100644
--- a/redfish-core/lib/fabric_adapters.hpp
+++ b/redfish-core/lib/fabric_adapters.hpp
@@ -33,7 +33,7 @@
         return;
     }
 
-    BMCWEB_LOG_ERROR << "DBus method call failed with error " << ec.value();
+    BMCWEB_LOG_ERROR("DBus method call failed with error {}", ec.value());
     messages::internalError(res);
 }
 
@@ -50,7 +50,7 @@
         {
             if (ec.value() != EBADR)
             {
-                BMCWEB_LOG_ERROR << "DBUS response error for Location";
+                BMCWEB_LOG_ERROR("DBUS response error for Location");
                 messages::internalError(asyncResp->res);
             }
             return;
@@ -76,7 +76,7 @@
         {
             if (ec.value() != EBADR)
             {
-                BMCWEB_LOG_ERROR << "DBUS response error for Properties";
+                BMCWEB_LOG_ERROR("DBUS response error for Properties");
                 messages::internalError(asyncResp->res);
             }
             return;
@@ -133,7 +133,7 @@
         {
             if (ec.value() != EBADR)
             {
-                BMCWEB_LOG_ERROR << "DBUS response error for State";
+                BMCWEB_LOG_ERROR("DBUS response error for State");
                 messages::internalError(asyncResp->res);
             }
             return;
@@ -160,7 +160,7 @@
         {
             if (ec.value() != EBADR)
             {
-                BMCWEB_LOG_ERROR << "DBUS response error for Health";
+                BMCWEB_LOG_ERROR("DBUS response error for Health");
                 messages::internalError(asyncResp->res);
             }
             return;
@@ -240,7 +240,7 @@
                 return;
             }
         }
-        BMCWEB_LOG_WARNING << "Adapter not found";
+        BMCWEB_LOG_WARNING("Adapter not found");
         messages::resourceNotFound(asyncResp->res, "FabricAdapter", adapterId);
         });
 }
diff --git a/redfish-core/lib/fan.hpp b/redfish-core/lib/fan.hpp
index 7680531..3a7e2e2 100644
--- a/redfish-core/lib/fan.hpp
+++ b/redfish-core/lib/fan.hpp
@@ -68,9 +68,9 @@
         {
             if (ec.value() != EBADR)
             {
-                BMCWEB_LOG_ERROR
-                    << "DBUS response error for getAssociatedSubTreePaths "
-                    << ec.value();
+                BMCWEB_LOG_ERROR(
+                    "DBUS response error for getAssociatedSubTreePaths {}",
+                    ec.value());
                 messages::internalError(asyncResp->res);
             }
             return;
@@ -185,8 +185,8 @@
                        const dbus::utility::MapperGetObject& object) {
             if (ec || object.empty())
             {
-                BMCWEB_LOG_ERROR << "DBUS response error on getDbusObject "
-                                 << ec.value();
+                BMCWEB_LOG_ERROR("DBUS response error on getDbusObject {}",
+                                 ec.value());
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -195,7 +195,7 @@
 
         return;
     }
-    BMCWEB_LOG_WARNING << "Fan not found " << fanId;
+    BMCWEB_LOG_WARNING("Fan not found {}", fanId);
     messages::resourceNotFound(asyncResp->res, "Fan", fanId);
 }
 
@@ -239,8 +239,8 @@
         {
             if (ec.value() != EBADR)
             {
-                BMCWEB_LOG_ERROR << "DBUS response error for Health "
-                                 << ec.value();
+                BMCWEB_LOG_ERROR("DBUS response error for Health {}",
+                                 ec.value());
                 messages::internalError(asyncResp->res);
             }
             return;
@@ -264,8 +264,8 @@
         {
             if (ec.value() != EBADR)
             {
-                BMCWEB_LOG_ERROR << "DBUS response error for State "
-                                 << ec.value();
+                BMCWEB_LOG_ERROR("DBUS response error for State {}",
+                                 ec.value());
                 messages::internalError(asyncResp->res);
             }
             return;
@@ -291,8 +291,8 @@
         {
             if (ec.value() != EBADR)
             {
-                BMCWEB_LOG_ERROR << "DBUS response error for Properties"
-                                 << ec.value();
+                BMCWEB_LOG_ERROR("DBUS response error for Properties{}",
+                                 ec.value());
                 messages::internalError(asyncResp->res);
             }
             return;
@@ -348,8 +348,8 @@
         {
             if (ec.value() != EBADR)
             {
-                BMCWEB_LOG_ERROR << "DBUS response error for Location"
-                                 << ec.value();
+                BMCWEB_LOG_ERROR("DBUS response error for Location{}",
+                                 ec.value());
                 messages::internalError(aResp->res);
             }
             return;
diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp
index c5249f2..55f79bc 100644
--- a/redfish-core/lib/health.hpp
+++ b/redfish-core/lib/health.hpp
@@ -114,8 +114,8 @@
                                 std::get_if<std::vector<std::string>>(&value);
                             if (endpoints == nullptr)
                             {
-                                BMCWEB_LOG_ERROR << "Illegal association at "
-                                                 << path.str;
+                                BMCWEB_LOG_ERROR("Illegal association at {}",
+                                                 path.str);
                                 continue;
                             }
                             bool containsChild = false;
diff --git a/redfish-core/lib/hypervisor_system.hpp b/redfish-core/lib/hypervisor_system.hpp
index 72d02b9..0a8936d 100644
--- a/redfish-core/lib/hypervisor_system.hpp
+++ b/redfish-core/lib/hypervisor_system.hpp
@@ -34,7 +34,7 @@
 inline void
     getHypervisorState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
-    BMCWEB_LOG_DEBUG << "Get hypervisor state information.";
+    BMCWEB_LOG_DEBUG("Get hypervisor state information.");
     sdbusplus::asio::getProperty<std::string>(
         *crow::connections::systemBus, "xyz.openbmc_project.State.Hypervisor",
         "/xyz/openbmc_project/state/hypervisor0",
@@ -43,13 +43,13 @@
                     const std::string& hostState) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+            BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
             // This is an optional D-Bus object so just return if
             // error occurs
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "Hypervisor state: " << hostState;
+        BMCWEB_LOG_DEBUG("Hypervisor state: {}", hostState);
         // Verify Host State
         if (hostState == "xyz.openbmc_project.State.Host.HostState.Running")
         {
@@ -106,7 +106,7 @@
 inline void
     getHypervisorActions(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
-    BMCWEB_LOG_DEBUG << "Get hypervisor actions.";
+    BMCWEB_LOG_DEBUG("Get hypervisor actions.");
     constexpr std::array<std::string_view, 1> interfaces = {
         "xyz.openbmc_project.State.Host"};
     dbus::utility::getDbusObject(
@@ -117,7 +117,7 @@
                 objInfo) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+            BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
             // This is an optional D-Bus object so just return if
             // error occurs
             return;
@@ -259,9 +259,9 @@
                         }
                         else
                         {
-                            BMCWEB_LOG_ERROR
-                                << "Got extra property: " << property.first
-                                << " on the " << objpath.first.str << " object";
+                            BMCWEB_LOG_ERROR(
+                                "Got extra property: {} on the {} object",
+                                property.first, objpath.first.str);
                         }
                     }
                 }
@@ -330,7 +330,7 @@
                                                     ipv4Data);
         if (!found)
         {
-            BMCWEB_LOG_INFO << "Hypervisor Interface not found";
+            BMCWEB_LOG_INFO("Hypervisor Interface not found");
         }
         callback(found, ethData, ipv4Data);
         });
@@ -349,8 +349,8 @@
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
     const std::string& ethIfaceId, const std::string& ipv4Address)
 {
-    BMCWEB_LOG_DEBUG << "Setting the Hypervisor IPaddress : " << ipv4Address
-                     << " on Iface: " << ethIfaceId;
+    BMCWEB_LOG_DEBUG("Setting the Hypervisor IPaddress : {} on Iface: {}",
+                     ipv4Address, ethIfaceId);
     sdbusplus::asio::setProperty(
         *crow::connections::systemBus, "xyz.openbmc_project.Settings",
         "/xyz/openbmc_project/network/hypervisor/" + ethIfaceId + "/ipv4/addr0",
@@ -358,10 +358,10 @@
         [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "DBUS response error " << ec;
+            BMCWEB_LOG_ERROR("DBUS response error {}", ec);
             return;
         }
-        BMCWEB_LOG_DEBUG << "Hypervisor IPaddress is Set";
+        BMCWEB_LOG_DEBUG("Hypervisor IPaddress is Set");
         });
 }
 
@@ -378,8 +378,8 @@
     setHypervisorIPv4Subnet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                             const std::string& ethIfaceId, const uint8_t subnet)
 {
-    BMCWEB_LOG_DEBUG << "Setting the Hypervisor subnet : " << subnet
-                     << " on Iface: " << ethIfaceId;
+    BMCWEB_LOG_DEBUG("Setting the Hypervisor subnet : {} on Iface: {}", subnet,
+                     ethIfaceId);
 
     sdbusplus::asio::setProperty(
         *crow::connections::systemBus, "xyz.openbmc_project.Settings",
@@ -388,10 +388,10 @@
         [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "DBUS response error " << ec;
+            BMCWEB_LOG_ERROR("DBUS response error {}", ec);
             return;
         }
-        BMCWEB_LOG_DEBUG << "SubnetMask is Set";
+        BMCWEB_LOG_DEBUG("SubnetMask is Set");
         });
 }
 
@@ -408,8 +408,8 @@
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
     const std::string& gateway)
 {
-    BMCWEB_LOG_DEBUG
-        << "Setting the DefaultGateway to the last configured gateway";
+    BMCWEB_LOG_DEBUG(
+        "Setting the DefaultGateway to the last configured gateway");
 
     sdbusplus::asio::setProperty(
         *crow::connections::systemBus, "xyz.openbmc_project.Settings",
@@ -418,10 +418,10 @@
         gateway, [asyncResp](const boost::system::error_code& ec) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "DBUS response error " << ec;
+                BMCWEB_LOG_ERROR("DBUS response error {}", ec);
                 return;
             }
-            BMCWEB_LOG_DEBUG << "Default Gateway is Set";
+            BMCWEB_LOG_DEBUG("Default Gateway is Set");
         });
 }
 
@@ -515,7 +515,7 @@
         [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+            BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -542,11 +542,11 @@
         [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "DBUS response error " << ec;
+            BMCWEB_LOG_ERROR("DBUS response error {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
-        BMCWEB_LOG_DEBUG << "Hypervisor IPaddress Origin is Set";
+        BMCWEB_LOG_DEBUG("Hypervisor IPaddress Origin is Set");
         });
 }
 
@@ -637,8 +637,8 @@
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "Calling createHypervisorIPv4 on : " << ifaceId
-                         << "," << *address;
+        BMCWEB_LOG_DEBUG("Calling createHypervisorIPv4 on : {},{}", ifaceId,
+                         *address);
         createHypervisorIPv4(ifaceId, prefixLength, *gateway, *address,
                              asyncResp);
         // Set the DHCPEnabled to false since the Static IPv4 is set
@@ -786,7 +786,7 @@
             messages::resourceNotFound(asyncResp->res, "System", "hypervisor");
             return;
         }
-        BMCWEB_LOG_DEBUG << "Hypervisor is available";
+        BMCWEB_LOG_DEBUG("Hypervisor is available");
 
         asyncResp->res.jsonValue["@odata.type"] =
             "#ComputerSystem.v1_6_0.ComputerSystem";
@@ -888,8 +888,8 @@
             if ((ipv4Json.is_null()) &&
                 (translateDhcpEnabledToBool(ethData.dhcpEnabled, true)))
             {
-                BMCWEB_LOG_INFO << "Ignoring the delete on ipv4StaticAddresses "
-                                   "as the interface is DHCP enabled";
+                BMCWEB_LOG_INFO("Ignoring the delete on ipv4StaticAddresses "
+                                "as the interface is DHCP enabled");
             }
             else
             {
@@ -929,7 +929,7 @@
                 objInfo) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+            BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
 
             // No hypervisor objects found by mapper
             if (ec.value() == boost::system::errc::io_error)
@@ -1012,7 +1012,7 @@
         [asyncResp, resetType](const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+            BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
             if (ec.value() == boost::asio::error::invalid_argument)
             {
                 messages::actionParameterNotSupported(asyncResp->res,
diff --git a/redfish-core/lib/led.hpp b/redfish-core/lib/led.hpp
index 53df1db..f36a319 100644
--- a/redfish-core/lib/led.hpp
+++ b/redfish-core/lib/led.hpp
@@ -35,7 +35,7 @@
 inline void
     getIndicatorLedState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
-    BMCWEB_LOG_DEBUG << "Get led groups";
+    BMCWEB_LOG_DEBUG("Get led groups");
     sdbusplus::asio::getProperty<bool>(
         *crow::connections::systemBus, "xyz.openbmc_project.LED.GroupManager",
         "/xyz/openbmc_project/led/groups/enclosure_identify_blink",
@@ -45,8 +45,8 @@
         // proceed to get enclosure_identify state.
         if (ec == boost::system::errc::invalid_argument)
         {
-            BMCWEB_LOG_DEBUG
-                << "Get identity blinking LED failed, missmatch in property type";
+            BMCWEB_LOG_DEBUG(
+                "Get identity blinking LED failed, missmatch in property type");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -67,8 +67,8 @@
                         const bool ledOn) {
             if (ec2 == boost::system::errc::invalid_argument)
             {
-                BMCWEB_LOG_DEBUG
-                    << "Get enclosure identity led failed, missmatch in property type";
+                BMCWEB_LOG_DEBUG(
+                    "Get enclosure identity led failed, missmatch in property type");
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -103,7 +103,7 @@
     setIndicatorLedState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                          const std::string& ledState)
 {
-    BMCWEB_LOG_DEBUG << "Set led groups";
+    BMCWEB_LOG_DEBUG("Set led groups");
     bool ledOn = false;
     bool ledBlinkng = false;
 
@@ -146,7 +146,7 @@
             [asyncResp](const boost::system::error_code& ec2) {
             if (ec2)
             {
-                BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
+                BMCWEB_LOG_DEBUG("DBUS response error {}", ec2);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -165,7 +165,7 @@
 inline void getLocationIndicatorActive(
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
-    BMCWEB_LOG_DEBUG << "Get LocationIndicatorActive";
+    BMCWEB_LOG_DEBUG("Get LocationIndicatorActive");
     sdbusplus::asio::getProperty<bool>(
         *crow::connections::systemBus, "xyz.openbmc_project.LED.GroupManager",
         "/xyz/openbmc_project/led/groups/enclosure_identify_blink",
@@ -175,8 +175,8 @@
         // proceed to get enclosure_identify state.
         if (ec == boost::system::errc::invalid_argument)
         {
-            BMCWEB_LOG_DEBUG
-                << "Get identity blinking LED failed, missmatch in property type";
+            BMCWEB_LOG_DEBUG(
+                "Get identity blinking LED failed, missmatch in property type");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -197,8 +197,8 @@
                         const bool ledOn) {
             if (ec2 == boost::system::errc::invalid_argument)
             {
-                BMCWEB_LOG_DEBUG
-                    << "Get enclosure identity led failed, missmatch in property type";
+                BMCWEB_LOG_DEBUG(
+                    "Get enclosure identity led failed, missmatch in property type");
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -224,7 +224,7 @@
 inline void setLocationIndicatorActive(
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const bool ledState)
 {
-    BMCWEB_LOG_DEBUG << "Set LocationIndicatorActive";
+    BMCWEB_LOG_DEBUG("Set LocationIndicatorActive");
 
     sdbusplus::asio::setProperty(
         *crow::connections::systemBus, "xyz.openbmc_project.LED.GroupManager",
@@ -244,7 +244,7 @@
                 [asyncResp](const boost::system::error_code& ec2) {
                 if (ec2)
                 {
-                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
+                    BMCWEB_LOG_DEBUG("DBUS response error {}", ec2);
                     messages::internalError(asyncResp->res);
                     return;
                 }
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 72930cc..9cb1fe0 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -159,8 +159,7 @@
     ret = sd_journal_get_realtime_usec(journal, &timestamp);
     if (ret < 0)
     {
-        BMCWEB_LOG_ERROR << "Failed to read entry timestamp: "
-                         << strerror(-ret);
+        BMCWEB_LOG_ERROR("Failed to read entry timestamp: {}", strerror(-ret));
         return false;
     }
     entryTimestamp = redfish::time_utils::getDateTimeUintUs(timestamp);
@@ -183,8 +182,7 @@
     ret = sd_journal_get_realtime_usec(journal, &curTs);
     if (ret < 0)
     {
-        BMCWEB_LOG_ERROR << "Failed to read entry timestamp: "
-                         << strerror(-ret);
+        BMCWEB_LOG_ERROR("Failed to read entry timestamp: {}", strerror(-ret));
         return false;
     }
     // If the timestamp isn't unique, increment the index
@@ -448,8 +446,8 @@
     }
     else
     {
-        BMCWEB_LOG_ERROR << "getDumpEntriesPath() invalid dump type: "
-                         << dumpType;
+        BMCWEB_LOG_ERROR("getDumpEntriesPath() invalid dump type: {}",
+                         dumpType);
     }
 
     // Returns empty string on error
@@ -475,7 +473,7 @@
                    const dbus::utility::ManagedObjectType& objects) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "DumpEntry resp_handler got error " << ec;
+            BMCWEB_LOG_ERROR("DumpEntry resp_handler got error {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -592,7 +590,7 @@
                       const dbus::utility::ManagedObjectType& resp) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "DumpEntry resp_handler got error " << ec;
+            BMCWEB_LOG_ERROR("DumpEntry resp_handler got error {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -665,7 +663,7 @@
         }
         if (!foundDumpEntry)
         {
-            BMCWEB_LOG_WARNING << "Can't find Dump Entry " << entryID;
+            BMCWEB_LOG_WARNING("Can't find Dump Entry {}", entryID);
             messages::resourceNotFound(asyncResp->res, dumpType + " dump",
                                        entryID);
             return;
@@ -679,7 +677,7 @@
 {
     auto respHandler =
         [asyncResp, entryID](const boost::system::error_code& ec) {
-        BMCWEB_LOG_DEBUG << "Dump Entry doDelete callback: Done";
+        BMCWEB_LOG_DEBUG("Dump Entry doDelete callback: Done");
         if (ec)
         {
             if (ec.value() == EBADR)
@@ -687,8 +685,9 @@
                 messages::resourceNotFound(asyncResp->res, "LogEntry", entryID);
                 return;
             }
-            BMCWEB_LOG_ERROR << "Dump (DBus) doDelete respHandler got error "
-                             << ec << " entryID=" << entryID;
+            BMCWEB_LOG_ERROR(
+                "Dump (DBus) doDelete respHandler got error {} entryID={}", ec,
+                entryID);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -728,7 +727,7 @@
             const std::string* value = std::get_if<std::string>(&val);
             if (value == nullptr)
             {
-                BMCWEB_LOG_ERROR << "Status property value is null";
+                BMCWEB_LOG_ERROR("Status property value is null");
                 return DumpCreationProgress::DUMP_CREATE_FAILED;
             }
             return mapDbusStatusToDumpProgress(*value);
@@ -762,7 +761,7 @@
 
     if (dumpEntryPath.empty())
     {
-        BMCWEB_LOG_ERROR << "Invalid dump type received";
+        BMCWEB_LOG_ERROR("Invalid dump type received");
         messages::internalError(asyncResp->res);
         return;
     }
@@ -774,8 +773,8 @@
                  const std::string& introspectXml) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "Introspect call failed with error: "
-                             << ec.message();
+            BMCWEB_LOG_ERROR("Introspect call failed with error: {}",
+                             ec.message());
             messages::internalError(asyncResp->res);
             return;
         }
@@ -790,7 +789,7 @@
         tinyxml2::XMLNode* pRoot = doc.FirstChildElement("node");
         if (pRoot == nullptr)
         {
-            BMCWEB_LOG_ERROR << "XML document failed to parse";
+            BMCWEB_LOG_ERROR("XML document failed to parse");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -822,8 +821,8 @@
                 const std::shared_ptr<task::TaskData>& taskData) {
             if (ec2)
             {
-                BMCWEB_LOG_ERROR << createdObjPath.str
-                                 << ": Error in creating dump";
+                BMCWEB_LOG_ERROR("{}: Error in creating dump",
+                                 createdObjPath.str);
                 taskData->messages.emplace_back(messages::internalError());
                 taskData->state = "Cancelled";
                 return task::completed;
@@ -839,16 +838,16 @@
                     getDumpCompletionStatus(values);
                 if (dumpStatus == DumpCreationProgress::DUMP_CREATE_FAILED)
                 {
-                    BMCWEB_LOG_ERROR << createdObjPath.str
-                                     << ": Error in creating dump";
+                    BMCWEB_LOG_ERROR("{}: Error in creating dump",
+                                     createdObjPath.str);
                     taskData->state = "Cancelled";
                     return task::completed;
                 }
 
                 if (dumpStatus == DumpCreationProgress::DUMP_CREATE_INPROGRESS)
                 {
-                    BMCWEB_LOG_DEBUG << createdObjPath.str
-                                     << ": Dump creation task is in progress";
+                    BMCWEB_LOG_DEBUG("{}: Dump creation task is in progress",
+                                     createdObjPath.str);
                     return !task::completed;
                 }
             }
@@ -864,8 +863,8 @@
 
             taskData->payload->httpHeaders.emplace_back(std::move(headerLoc));
 
-            BMCWEB_LOG_DEBUG << createdObjPath.str
-                             << ": Dump creation task completed";
+            BMCWEB_LOG_DEBUG("{}: Dump creation task completed",
+                             createdObjPath.str);
             taskData->state = "Completed";
             return task::completed;
             },
@@ -907,8 +906,8 @@
     {
         if (!oemDiagnosticDataType || !diagnosticDataType)
         {
-            BMCWEB_LOG_ERROR
-                << "CreateDump action parameter 'DiagnosticDataType'/'OEMDiagnosticDataType' value not found!";
+            BMCWEB_LOG_ERROR(
+                "CreateDump action parameter 'DiagnosticDataType'/'OEMDiagnosticDataType' value not found!");
             messages::actionParameterMissing(
                 asyncResp->res, "CollectDiagnosticData",
                 "DiagnosticDataType & OEMDiagnosticDataType");
@@ -917,7 +916,7 @@
         if ((*oemDiagnosticDataType != "System") ||
             (*diagnosticDataType != "OEM"))
         {
-            BMCWEB_LOG_ERROR << "Wrong parameter values passed";
+            BMCWEB_LOG_ERROR("Wrong parameter values passed");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -927,16 +926,16 @@
     {
         if (!diagnosticDataType)
         {
-            BMCWEB_LOG_ERROR
-                << "CreateDump action parameter 'DiagnosticDataType' not found!";
+            BMCWEB_LOG_ERROR(
+                "CreateDump action parameter 'DiagnosticDataType' not found!");
             messages::actionParameterMissing(
                 asyncResp->res, "CollectDiagnosticData", "DiagnosticDataType");
             return;
         }
         if (*diagnosticDataType != "Manager")
         {
-            BMCWEB_LOG_ERROR
-                << "Wrong parameter value passed for 'DiagnosticDataType'";
+            BMCWEB_LOG_ERROR(
+                "Wrong parameter value passed for 'DiagnosticDataType'");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -944,7 +943,7 @@
     }
     else
     {
-        BMCWEB_LOG_ERROR << "CreateDump failed. Unknown dump type";
+        BMCWEB_LOG_ERROR("CreateDump failed. Unknown dump type");
         messages::internalError(asyncResp->res);
         return;
     }
@@ -969,7 +968,7 @@
                    const sdbusplus::message::object_path& objPath) mutable {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "CreateDump resp_handler got error " << ec;
+            BMCWEB_LOG_ERROR("CreateDump resp_handler got error {}", ec);
             const sd_bus_error* dbusError = msg.get_error();
             if (dbusError == nullptr)
             {
@@ -977,8 +976,8 @@
                 return;
             }
 
-            BMCWEB_LOG_ERROR << "CreateDump DBus error: " << dbusError->name
-                             << " and error msg: " << dbusError->message;
+            BMCWEB_LOG_ERROR("CreateDump DBus error: {} and error msg: {}",
+                             dbusError->name, dbusError->message);
             if (std::string_view(
                     "xyz.openbmc_project.Common.Error.NotAllowed") ==
                 dbusError->name)
@@ -1010,7 +1009,7 @@
             messages::internalError(asyncResp->res);
             return;
         }
-        BMCWEB_LOG_DEBUG << "Dump Created. Path: " << objPath.str;
+        BMCWEB_LOG_DEBUG("Dump Created. Path: {}", objPath.str);
         createDumpTaskCallback(std::move(payload), asyncResp, objPath);
         },
         "xyz.openbmc_project.Dump.Manager",
@@ -1029,7 +1028,7 @@
         [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "clearDump resp_handler got error " << ec;
+            BMCWEB_LOG_ERROR("clearDump resp_handler got error {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -1148,7 +1147,7 @@
                             subtreePath) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR << ec;
+                BMCWEB_LOG_ERROR("{}", ec);
                 return;
             }
 
@@ -1252,7 +1251,7 @@
             [asyncResp](const boost::system::error_code& ec) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "Failed to reload rsyslog: " << ec;
+                BMCWEB_LOG_ERROR("Failed to reload rsyslog: {}", ec);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -1309,7 +1308,7 @@
     logEntryIter++;
     if (message == nullptr)
     {
-        BMCWEB_LOG_WARNING << "Log entry not found in registry: " << logEntry;
+        BMCWEB_LOG_WARNING("Log entry not found in registry: {}", logEntry);
         return LogParseError::messageIdNotInRegistry;
     }
 
@@ -1584,8 +1583,8 @@
             if (ec)
             {
                 // TODO Handle for specific error code
-                BMCWEB_LOG_ERROR
-                    << "getLogEntriesIfaceData resp_handler got error " << ec;
+                BMCWEB_LOG_ERROR(
+                    "getLogEntriesIfaceData resp_handler got error {}", ec);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -1781,8 +1780,8 @@
             }
             if (ec)
             {
-                BMCWEB_LOG_ERROR
-                    << "EventLogEntry (DBus) resp_handler got error " << ec;
+                BMCWEB_LOG_ERROR(
+                    "EventLogEntry (DBus) resp_handler got error {}", ec);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -1883,7 +1882,7 @@
         {
             return;
         }
-        BMCWEB_LOG_DEBUG << "Set Resolved";
+        BMCWEB_LOG_DEBUG("Set Resolved");
 
         sdbusplus::asio::setProperty(
             *crow::connections::systemBus, "xyz.openbmc_project.Logging",
@@ -1892,7 +1891,7 @@
             [asyncResp, entryId](const boost::system::error_code& ec) {
             if (ec)
             {
-                BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+                BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -1924,7 +1923,7 @@
                                        systemName);
             return;
         }
-        BMCWEB_LOG_DEBUG << "Do delete single event entries.";
+        BMCWEB_LOG_DEBUG("Do delete single event entries.");
 
         std::string entryID = param;
 
@@ -1933,7 +1932,7 @@
         // Process response from Logging service.
         auto respHandler =
             [asyncResp, entryID](const boost::system::error_code& ec) {
-            BMCWEB_LOG_DEBUG << "EventLogEntry (DBus) doDelete callback: Done";
+            BMCWEB_LOG_DEBUG("EventLogEntry (DBus) doDelete callback: Done");
             if (ec)
             {
                 if (ec.value() == EBADR)
@@ -1943,9 +1942,9 @@
                     return;
                 }
                 // TODO Handle for specific error code
-                BMCWEB_LOG_ERROR
-                    << "EventLogEntry (DBus) doDelete respHandler got error "
-                    << ec;
+                BMCWEB_LOG_ERROR(
+                    "EventLogEntry (DBus) doDelete respHandler got error {}",
+                    ec);
                 asyncResp->res.result(
                     boost::beast::http::status::internal_server_error);
                 return;
@@ -2011,7 +2010,7 @@
             }
             if (ec)
             {
-                BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+                BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -2035,8 +2034,8 @@
             constexpr int maxFileSize = 65536;
             if (size > maxFileSize)
             {
-                BMCWEB_LOG_ERROR << "File size exceeds maximum allowed size of "
-                                 << maxFileSize;
+                BMCWEB_LOG_ERROR("File size exceeds maximum allowed size of {}",
+                                 maxFileSize);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -2080,7 +2079,7 @@
     std::filesystem::directory_iterator logPath(hostLoggerFilePath, ec);
     if (ec)
     {
-        BMCWEB_LOG_ERROR << ec.message();
+        BMCWEB_LOG_ERROR("{}", ec.message());
         return false;
     }
     for (const std::filesystem::directory_entry& it : logPath)
@@ -2113,7 +2112,7 @@
     {
         if (!logFile.gzGetLines(it.string(), skip, top, logEntries, logCount))
         {
-            BMCWEB_LOG_ERROR << "fail to expose host logs";
+            BMCWEB_LOG_ERROR("fail to expose host logs");
             return false;
         }
     }
@@ -2230,7 +2229,7 @@
         std::vector<std::filesystem::path> hostLoggerFiles;
         if (!getHostLoggerFiles(hostLoggerFolderPath, hostLoggerFiles))
         {
-            BMCWEB_LOG_ERROR << "fail to get host log file path";
+            BMCWEB_LOG_ERROR("fail to get host log file path");
             return;
         }
         // If we weren't provided top and skip limits, use the defaults.
@@ -2316,7 +2315,7 @@
         std::vector<std::filesystem::path> hostLoggerFiles;
         if (!getHostLoggerFiles(hostLoggerFolderPath, hostLoggerFiles))
         {
-            BMCWEB_LOG_ERROR << "fail to get host log file path";
+            BMCWEB_LOG_ERROR("fail to get host log file path");
             return;
         }
 
@@ -2384,9 +2383,9 @@
             const dbus::utility::MapperGetSubTreePathsResponse& subTreePaths) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR
-                << "handleBMCLogServicesCollectionGet respHandler got error "
-                << ec;
+            BMCWEB_LOG_ERROR(
+                "handleBMCLogServicesCollectionGet respHandler got error {}",
+                ec);
             // Assume that getting an error simply means there are no dump
             // LogServices. Return without adding any error response.
             return;
@@ -2471,8 +2470,8 @@
     ret = getJournalMetadata(journal, "SYSLOG_IDENTIFIER", syslogID);
     if (ret < 0)
     {
-        BMCWEB_LOG_ERROR << "Failed to read SYSLOG_IDENTIFIER field: "
-                         << strerror(-ret);
+        BMCWEB_LOG_ERROR("Failed to read SYSLOG_IDENTIFIER field: {}",
+                         strerror(-ret));
     }
     if (!syslogID.empty())
     {
@@ -2483,7 +2482,7 @@
     ret = getJournalMetadata(journal, "MESSAGE", msg);
     if (ret < 0)
     {
-        BMCWEB_LOG_ERROR << "Failed to read MESSAGE field: " << strerror(-ret);
+        BMCWEB_LOG_ERROR("Failed to read MESSAGE field: {}", strerror(-ret));
         return 1;
     }
     message += std::string(msg);
@@ -2493,7 +2492,7 @@
     ret = getJournalMetadata(journal, "PRIORITY", 10, severity);
     if (ret < 0)
     {
-        BMCWEB_LOG_ERROR << "Failed to read PRIORITY field: " << strerror(-ret);
+        BMCWEB_LOG_ERROR("Failed to read PRIORITY field: {}", strerror(-ret));
     }
 
     // Get the Created time from the timestamp
@@ -2559,7 +2558,7 @@
         int ret = sd_journal_open(&journalTmp, SD_JOURNAL_LOCAL_ONLY);
         if (ret < 0)
         {
-            BMCWEB_LOG_ERROR << "failed to open journal: " << strerror(-ret);
+            BMCWEB_LOG_ERROR("failed to open journal: {}", strerror(-ret));
             messages::internalError(asyncResp->res);
             return;
         }
@@ -2630,7 +2629,7 @@
         int ret = sd_journal_open(&journalTmp, SD_JOURNAL_LOCAL_ONLY);
         if (ret < 0)
         {
-            BMCWEB_LOG_ERROR << "failed to open journal: " << strerror(-ret);
+            BMCWEB_LOG_ERROR("failed to open journal: {}", strerror(-ret));
             messages::internalError(asyncResp->res);
             return;
         }
@@ -2644,8 +2643,8 @@
         ret = sd_journal_seek_realtime_usec(journal.get(), ts);
         if (ret < 0)
         {
-            BMCWEB_LOG_ERROR << "failed to seek to an entry in journal"
-                             << strerror(-ret);
+            BMCWEB_LOG_ERROR("failed to seek to an entry in journal{}",
+                             strerror(-ret));
             messages::internalError(asyncResp->res);
             return;
         }
@@ -2705,8 +2704,8 @@
     }
     else
     {
-        BMCWEB_LOG_ERROR << "getDumpServiceInfo() invalid dump type: "
-                         << dumpType;
+        BMCWEB_LOG_ERROR("getDumpServiceInfo() invalid dump type: {}",
+                         dumpType);
         messages::internalError(asyncResp->res);
         return;
     }
@@ -2741,8 +2740,7 @@
             const dbus::utility::MapperGetSubTreePathsResponse& subTreePaths) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "getDumpServiceInfo respHandler got error "
-                             << ec;
+            BMCWEB_LOG_ERROR("getDumpServiceInfo respHandler got error {}", ec);
             // Assume that getting an error simply means there are no dump
             // LogServices. Return without adding any error response.
             return;
@@ -3212,7 +3210,7 @@
                         const dbus::utility::DBusPropertiesMap& params) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "failed to get log ec: " << ec.message();
+            BMCWEB_LOG_DEBUG("failed to get log ec: {}", ec.message());
             if (ec.value() ==
                 boost::system::linux_error::bad_request_descriptor)
             {
@@ -3317,8 +3315,8 @@
                 if (ec.value() !=
                     boost::system::errc::no_such_file_or_directory)
                 {
-                    BMCWEB_LOG_DEBUG << "failed to get entries ec: "
-                                     << ec.message();
+                    BMCWEB_LOG_DEBUG("failed to get entries ec: {}",
+                                     ec.message());
                     messages::internalError(asyncResp->res);
                     return;
                 }
@@ -3424,7 +3422,7 @@
                     resp) {
             if (ec)
             {
-                BMCWEB_LOG_DEBUG << "failed to get log ec: " << ec.message();
+                BMCWEB_LOG_DEBUG("failed to get log ec: {}", ec.message());
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -3536,8 +3534,8 @@
 
         if (diagnosticDataType != "OEM")
         {
-            BMCWEB_LOG_ERROR
-                << "Only OEM DiagnosticDataType supported for Crashdump";
+            BMCWEB_LOG_ERROR(
+                "Only OEM DiagnosticDataType supported for Crashdump");
             messages::actionParameterValueFormatError(
                 asyncResp->res, diagnosticDataType, "DiagnosticDataType",
                 "CollectDiagnosticData");
@@ -3570,8 +3568,8 @@
         }
         else
         {
-            BMCWEB_LOG_ERROR << "Unsupported OEMDiagnosticDataType: "
-                             << oemDiagnosticDataType;
+            BMCWEB_LOG_ERROR("Unsupported OEMDiagnosticDataType: {}",
+                             oemDiagnosticDataType);
             messages::actionParameterValueFormatError(
                 asyncResp->res, oemDiagnosticDataType, "OEMDiagnosticDataType",
                 "CollectDiagnosticData");
@@ -3660,15 +3658,15 @@
                                        systemName);
             return;
         }
-        BMCWEB_LOG_DEBUG << "Do delete all entries.";
+        BMCWEB_LOG_DEBUG("Do delete all entries.");
 
         // Process response from Logging service.
         auto respHandler = [asyncResp](const boost::system::error_code& ec) {
-            BMCWEB_LOG_DEBUG << "doClearLog resp_handler callback: Done";
+            BMCWEB_LOG_DEBUG("doClearLog resp_handler callback: Done");
             if (ec)
             {
                 // TODO Handle for specific error code
-                BMCWEB_LOG_ERROR << "doClearLog resp_handler got error " << ec;
+                BMCWEB_LOG_ERROR("doClearLog resp_handler got error {}", ec);
                 asyncResp->res.result(
                     boost::beast::http::status::internal_server_error);
                 return;
@@ -3766,7 +3764,7 @@
                                        systemName);
             return;
         }
-        BMCWEB_LOG_DEBUG << "Do delete all postcodes entries.";
+        BMCWEB_LOG_DEBUG("Do delete all postcodes entries.");
 
         // Make call to post-code service to request clear all
         crow::connections::systemBus->async_method_call(
@@ -3774,8 +3772,8 @@
             if (ec)
             {
                 // TODO Handle for specific error code
-                BMCWEB_LOG_ERROR << "doClearPostCodes resp_handler got error "
-                                 << ec;
+                BMCWEB_LOG_ERROR("doClearPostCodes resp_handler got error {}",
+                                 ec);
                 asyncResp->res.result(
                     boost::beast::http::status::internal_server_error);
                 messages::internalError(asyncResp->res);
@@ -3982,7 +3980,7 @@
                         postcode) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS POST CODE PostCode response error";
+            BMCWEB_LOG_DEBUG("DBUS POST CODE PostCode response error");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -4018,7 +4016,7 @@
                   postcode) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS POST CODE PostCode response error";
+            BMCWEB_LOG_DEBUG("DBUS POST CODE PostCode response error");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -4075,7 +4073,7 @@
                                            const uint16_t bootCount) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+            BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -4188,7 +4186,7 @@
             }
             if (ec)
             {
-                BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+                BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -4196,7 +4194,7 @@
             size_t value = static_cast<size_t>(currentValue) - 1;
             if (value == std::string::npos || postcodes.size() < currentValue)
             {
-                BMCWEB_LOG_WARNING << "Wrong currentValue value";
+                BMCWEB_LOG_WARNING("Wrong currentValue value");
                 messages::resourceNotFound(asyncResp->res, "LogEntry",
                                            postCodeID);
                 return;
@@ -4205,7 +4203,7 @@
             const auto& [tID, c] = postcodes[value];
             if (c.empty())
             {
-                BMCWEB_LOG_WARNING << "No found post code data";
+                BMCWEB_LOG_WARNING("No found post code data");
                 messages::resourceNotFound(asyncResp->res, "LogEntry",
                                            postCodeID);
                 return;
diff --git a/redfish-core/lib/manager_diagnostic_data.hpp b/redfish-core/lib/manager_diagnostic_data.hpp
index ec74231..4dedc3f 100644
--- a/redfish-core/lib/manager_diagnostic_data.hpp
+++ b/redfish-core/lib/manager_diagnostic_data.hpp
@@ -37,7 +37,7 @@
 
     if (runTime < steady_clock::duration::zero())
     {
-        BMCWEB_LOG_CRITICAL << "Uptime was negative????";
+        BMCWEB_LOG_CRITICAL("Uptime was negative????");
         messages::internalError(asyncResp->res);
         return;
     }
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index c97ba02..a114d44 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -68,7 +68,7 @@
         // Use "Set" method to set the property value.
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "[Set] Bad D-Bus request error: " << ec;
+            BMCWEB_LOG_DEBUG("[Set] Bad D-Bus request error: {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -95,7 +95,7 @@
         // Use "Set" method to set the property value.
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "[Set] Bad D-Bus request error: " << ec;
+            BMCWEB_LOG_DEBUG("[Set] Bad D-Bus request error: {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -125,7 +125,7 @@
         {
             return;
         }
-        BMCWEB_LOG_DEBUG << "Post Manager Reset.";
+        BMCWEB_LOG_DEBUG("Post Manager Reset.");
 
         std::string resetType;
 
@@ -137,18 +137,17 @@
 
         if (resetType == "GracefulRestart")
         {
-            BMCWEB_LOG_DEBUG << "Proceeding with " << resetType;
+            BMCWEB_LOG_DEBUG("Proceeding with {}", resetType);
             doBMCGracefulRestart(asyncResp);
             return;
         }
         if (resetType == "ForceRestart")
         {
-            BMCWEB_LOG_DEBUG << "Proceeding with " << resetType;
+            BMCWEB_LOG_DEBUG("Proceeding with {}", resetType);
             doBMCForceRestart(asyncResp);
             return;
         }
-        BMCWEB_LOG_DEBUG << "Invalid property value for ResetType: "
-                         << resetType;
+        BMCWEB_LOG_DEBUG("Invalid property value for ResetType: {}", resetType);
         messages::actionParameterNotSupported(asyncResp->res, resetType,
                                               "ResetType");
 
@@ -184,14 +183,14 @@
         {
             return;
         }
-        BMCWEB_LOG_DEBUG << "Post ResetToDefaults.";
+        BMCWEB_LOG_DEBUG("Post ResetToDefaults.");
 
         std::string resetType;
 
         if (!json_util::readJsonAction(req, asyncResp->res,
                                        "ResetToDefaultsType", resetType))
         {
-            BMCWEB_LOG_DEBUG << "Missing property ResetToDefaultsType.";
+            BMCWEB_LOG_DEBUG("Missing property ResetToDefaultsType.");
 
             messages::actionParameterMissing(asyncResp->res, "ResetToDefaults",
                                              "ResetToDefaultsType");
@@ -200,9 +199,9 @@
 
         if (resetType != "ResetAll")
         {
-            BMCWEB_LOG_DEBUG
-                << "Invalid property value for ResetToDefaultsType: "
-                << resetType;
+            BMCWEB_LOG_DEBUG(
+                "Invalid property value for ResetToDefaultsType: {}",
+                resetType);
             messages::actionParameterNotSupported(asyncResp->res, resetType,
                                                   "ResetToDefaultsType");
             return;
@@ -212,7 +211,7 @@
             [asyncResp](const boost::system::error_code& ec) {
             if (ec)
             {
-                BMCWEB_LOG_DEBUG << "Failed to ResetToDefaults: " << ec;
+                BMCWEB_LOG_DEBUG("Failed to ResetToDefaults: {}", ec);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -294,7 +293,7 @@
             const dbus::utility::ManagedObjectType& managedObj) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << ec;
+            BMCWEB_LOG_ERROR("{}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -327,7 +326,7 @@
         {
             configRoot["Profile"] = currentProfile;
         }
-        BMCWEB_LOG_ERROR << "profile = " << currentProfile << " !";
+        BMCWEB_LOG_ERROR("profile = {} !", currentProfile);
 
         for (const auto& pathPair : managedObj)
         {
@@ -352,7 +351,7 @@
                             std::get_if<std::string>(&propPair.second);
                         if (namePtr == nullptr)
                         {
-                            BMCWEB_LOG_ERROR << "Pid Name Field illegal";
+                            BMCWEB_LOG_ERROR("Pid Name Field illegal");
                             messages::internalError(asyncResp->res);
                             return;
                         }
@@ -366,15 +365,15 @@
                                 &propPair.second);
                         if (profiles == nullptr)
                         {
-                            BMCWEB_LOG_ERROR << "Pid Profiles Field illegal";
+                            BMCWEB_LOG_ERROR("Pid Profiles Field illegal");
                             messages::internalError(asyncResp->res);
                             return;
                         }
                         if (std::find(profiles->begin(), profiles->end(),
                                       currentProfile) == profiles->end())
                         {
-                            BMCWEB_LOG_INFO
-                                << name << " not supported in current profile";
+                            BMCWEB_LOG_INFO(
+                                "{} not supported in current profile", name);
                             continue;
                         }
                     }
@@ -416,7 +415,7 @@
                 {
                     if (classPtr == nullptr)
                     {
-                        BMCWEB_LOG_ERROR << "Pid Class Field illegal";
+                        BMCWEB_LOG_ERROR("Pid Class Field illegal");
                         messages::internalError(asyncResp->res);
                         return;
                     }
@@ -439,7 +438,7 @@
                 {
                     if (classPtr == nullptr)
                     {
-                        BMCWEB_LOG_ERROR << "Pid Class Field illegal";
+                        BMCWEB_LOG_ERROR("Pid Class Field illegal");
                         messages::internalError(asyncResp->res);
                         return;
                     }
@@ -467,7 +466,7 @@
                 }
                 else
                 {
-                    BMCWEB_LOG_ERROR << "Unexpected configuration";
+                    BMCWEB_LOG_ERROR("Unexpected configuration");
                     messages::internalError(asyncResp->res);
                     return;
                 }
@@ -492,8 +491,8 @@
                             std::get_if<double>(&propertyPair.second);
                         if (ptr == nullptr)
                         {
-                            BMCWEB_LOG_ERROR << "Field Illegal "
-                                             << propertyPair.first;
+                            BMCWEB_LOG_ERROR("Field Illegal {}",
+                                             propertyPair.first);
                             messages::internalError(asyncResp->res);
                             return;
                         }
@@ -511,8 +510,8 @@
 
                             if (ptr == nullptr)
                             {
-                                BMCWEB_LOG_ERROR << "Field Illegal "
-                                                 << propertyPair.first;
+                                BMCWEB_LOG_ERROR("Field Illegal {}",
+                                                 propertyPair.first);
                                 messages::internalError(asyncResp->res);
                                 return;
                             }
@@ -529,8 +528,8 @@
                             {
                                 if (keys->size() != values->size())
                                 {
-                                    BMCWEB_LOG_ERROR
-                                        << "Reading and Output size don't match ";
+                                    BMCWEB_LOG_ERROR(
+                                        "Reading and Output size don't match ");
                                     messages::internalError(asyncResp->res);
                                     return;
                                 }
@@ -552,8 +551,8 @@
                                 std::get_if<double>(&propertyPair.second);
                             if (ptr == nullptr)
                             {
-                                BMCWEB_LOG_ERROR << "Field Illegal "
-                                                 << propertyPair.first;
+                                BMCWEB_LOG_ERROR("Field Illegal {}",
+                                                 propertyPair.first);
                                 messages::internalError(asyncResp->res);
                                 return;
                             }
@@ -573,7 +572,7 @@
 
                             if (inputs == nullptr)
                             {
-                                BMCWEB_LOG_ERROR << "Zones Pid Field Illegal";
+                                BMCWEB_LOG_ERROR("Zones Pid Field Illegal");
                                 messages::internalError(asyncResp->res);
                                 return;
                             }
@@ -609,8 +608,8 @@
 
                             if (inputs == nullptr)
                             {
-                                BMCWEB_LOG_ERROR << "Field Illegal "
-                                                 << propertyPair.first;
+                                BMCWEB_LOG_ERROR("Field Illegal {}",
+                                                 propertyPair.first);
                                 messages::internalError(asyncResp->res);
                                 return;
                             }
@@ -623,8 +622,8 @@
 
                             if (ptr == nullptr)
                             {
-                                BMCWEB_LOG_ERROR << "Field Illegal "
-                                                 << propertyPair.first;
+                                BMCWEB_LOG_ERROR("Field Illegal {}",
+                                                 propertyPair.first);
                                 messages::internalError(asyncResp->res);
                                 return;
                             }
@@ -651,7 +650,7 @@
                             }
                             else
                             {
-                                BMCWEB_LOG_ERROR << "Value Illegal " << *ptr;
+                                BMCWEB_LOG_ERROR("Value Illegal {}", *ptr);
                                 messages::internalError(asyncResp->res);
                                 return;
                             }
@@ -675,8 +674,8 @@
                                 std::get_if<double>(&propertyPair.second);
                             if (ptr == nullptr)
                             {
-                                BMCWEB_LOG_ERROR << "Field Illegal "
-                                                 << propertyPair.first;
+                                BMCWEB_LOG_ERROR("Field Illegal {}",
+                                                 propertyPair.first);
                                 messages::internalError(asyncResp->res);
                                 return;
                             }
@@ -703,7 +702,7 @@
 {
     if (config.empty())
     {
-        BMCWEB_LOG_ERROR << "Empty Zones";
+        BMCWEB_LOG_ERROR("Empty Zones");
         messages::propertyValueFormatError(response->res, config, "Zones");
         return false;
     }
@@ -722,8 +721,8 @@
         //     0    1     2      3    4    5      6     7      8
         if (!dbus::utility::getNthStringFromPath(path, 8, input))
         {
-            BMCWEB_LOG_ERROR << "Got invalid path " << path;
-            BMCWEB_LOG_ERROR << "Illegal Type Zones";
+            BMCWEB_LOG_ERROR("Got invalid path {}", path);
+            BMCWEB_LOG_ERROR("Illegal Type Zones");
             messages::propertyValueFormatError(response->res, odata, "Zones");
             return false;
         }
@@ -737,7 +736,7 @@
     findChassis(const dbus::utility::ManagedObjectType& managedObj,
                 const std::string& value, std::string& chassis)
 {
-    BMCWEB_LOG_DEBUG << "Find Chassis: " << value << "\n";
+    BMCWEB_LOG_DEBUG("Find Chassis: {}", value);
 
     std::string escaped = value;
     std::replace(escaped.begin(), escaped.end(), ' ', '_');
@@ -746,7 +745,7 @@
                            [&escaped](const auto& obj) {
         if (boost::algorithm::ends_with(obj.first.str, escaped))
         {
-            BMCWEB_LOG_DEBUG << "Matched " << obj.first.str << "\n";
+            BMCWEB_LOG_DEBUG("Matched {}", obj.first.str);
             return true;
         }
         return false;
@@ -791,18 +790,18 @@
         }
         else
         {
-            BMCWEB_LOG_ERROR << "Illegal Type " << type;
+            BMCWEB_LOG_ERROR("Illegal Type {}", type);
             messages::propertyUnknown(response->res, type);
             return CreatePIDRet::fail;
         }
 
-        BMCWEB_LOG_DEBUG << "del " << path << " " << iface << "\n";
+        BMCWEB_LOG_DEBUG("del {} {}", path, iface);
         // delete interface
         crow::connections::systemBus->async_method_call(
             [response, path](const boost::system::error_code& ec) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "Error patching " << path << ": " << ec;
+                BMCWEB_LOG_ERROR("Error patching {}: {}", path, ec);
                 messages::internalError(response->res);
                 return;
             }
@@ -820,7 +819,7 @@
         managedItem = findChassis(managedObj, it.key(), chassis);
         if (managedItem == nullptr)
         {
-            BMCWEB_LOG_ERROR << "Failed to get chassis from config patch";
+            BMCWEB_LOG_ERROR("Failed to get chassis from config patch");
             messages::invalidObject(
                 response->res,
                 boost::urls::format("/redfish/v1/Chassis/{}", chassis));
@@ -862,8 +861,8 @@
                                     &(prop.second));
                             if (curProfiles == nullptr)
                             {
-                                BMCWEB_LOG_ERROR
-                                    << "Illegal profiles in managed object";
+                                BMCWEB_LOG_ERROR(
+                                    "Illegal profiles in managed object");
                                 messages::internalError(response->res);
                                 return CreatePIDRet::fail;
                             }
@@ -883,8 +882,7 @@
 
             if (!ifaceFound)
             {
-                BMCWEB_LOG_ERROR
-                    << "Failed to find interface in managed object";
+                BMCWEB_LOG_ERROR("Failed to find interface in managed object");
                 messages::internalError(response->res);
                 return CreatePIDRet::fail;
             }
@@ -926,13 +924,13 @@
             std::vector<std::string> zonesStr;
             if (!getZonesFromJsonReq(response, *zones, zonesStr))
             {
-                BMCWEB_LOG_ERROR << "Illegal Zones";
+                BMCWEB_LOG_ERROR("Illegal Zones");
                 return CreatePIDRet::fail;
             }
             if (chassis.empty() &&
                 findChassis(managedObj, zonesStr[0], chassis) == nullptr)
             {
-                BMCWEB_LOG_ERROR << "Failed to get chassis from config patch";
+                BMCWEB_LOG_ERROR("Failed to get chassis from config patch");
                 messages::invalidObject(
                     response->res,
                     boost::urls::format("/redfish/v1/Chassis/{}", chassis));
@@ -980,8 +978,7 @@
             }
             else
             {
-                BMCWEB_LOG_ERROR << "Invalid setpointoffset "
-                                 << *setpointOffset;
+                BMCWEB_LOG_ERROR("Invalid setpointoffset {}", *setpointOffset);
                 messages::propertyValueNotInList(response->res, it.key(),
                                                  "SetPointOffset");
                 return CreatePIDRet::fail;
@@ -995,7 +992,7 @@
             {
                 continue;
             }
-            BMCWEB_LOG_DEBUG << pairs.first << " = " << *pairs.second;
+            BMCWEB_LOG_DEBUG("{} = {}", pairs.first, *pairs.second);
             output.emplace_back(pairs.first, *pairs.second);
         }
     }
@@ -1027,7 +1024,7 @@
             // /redfish/v1/chassis/chassis_name/
             if (!dbus::utility::getNthStringFromPath(chassisId, 3, chassis))
             {
-                BMCWEB_LOG_ERROR << "Got invalid path " << chassisId;
+                BMCWEB_LOG_ERROR("Got invalid path {}", chassisId);
                 messages::invalidObject(
                     response->res,
                     boost::urls::format("/redfish/v1/Chassis/{}", chassisId));
@@ -1067,13 +1064,13 @@
             std::vector<std::string> zonesStrs;
             if (!getZonesFromJsonReq(response, *zones, zonesStrs))
             {
-                BMCWEB_LOG_ERROR << "Illegal Zones";
+                BMCWEB_LOG_ERROR("Illegal Zones");
                 return CreatePIDRet::fail;
             }
             if (chassis.empty() &&
                 findChassis(managedObj, zonesStrs[0], chassis) == nullptr)
             {
-                BMCWEB_LOG_ERROR << "Failed to get chassis from config patch";
+                BMCWEB_LOG_ERROR("Failed to get chassis from config patch");
                 messages::invalidObject(
                     response->res,
                     boost::urls::format("/redfish/v1/Chassis/{}", chassis));
@@ -1133,7 +1130,7 @@
     }
     else
     {
-        BMCWEB_LOG_ERROR << "Illegal Type " << type;
+        BMCWEB_LOG_ERROR("Illegal Type {}", type);
         messages::propertyUnknown(response->res, type);
         return CreatePIDRet::fail;
     }
@@ -1169,7 +1166,7 @@
                 const dbus::utility::MapperGetSubTreeResponse& subtreeLocal) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR << ec;
+                BMCWEB_LOG_ERROR("{}", ec);
                 messages::internalError(self->asyncResp->res);
                 return;
             }
@@ -1191,7 +1188,7 @@
             if (subtreeLocal[0].second.size() != 1)
             {
                 // invalid mapper response, should never happen
-                BMCWEB_LOG_ERROR << "GetPIDValues: Mapper Error";
+                BMCWEB_LOG_ERROR("GetPIDValues: Mapper Error");
                 messages::internalError(self->asyncResp->res);
                 return;
             }
@@ -1206,8 +1203,8 @@
                        const dbus::utility::DBusPropertiesMap& resp) {
                 if (ec2)
                 {
-                    BMCWEB_LOG_ERROR
-                        << "GetPIDValues: Can't get thermalModeIface " << path;
+                    BMCWEB_LOG_ERROR(
+                        "GetPIDValues: Can't get thermalModeIface {}", path);
                     messages::internalError(self->asyncResp->res);
                     return;
                 }
@@ -1227,8 +1224,8 @@
 
                 if (current == nullptr || supported == nullptr)
                 {
-                    BMCWEB_LOG_ERROR
-                        << "GetPIDValues: thermal mode iface invalid " << path;
+                    BMCWEB_LOG_ERROR(
+                        "GetPIDValues: thermal mode iface invalid {}", path);
                     messages::internalError(self->asyncResp->res);
                     return;
                 }
@@ -1280,8 +1277,8 @@
                             objectMgrPaths.find(connectionGroup.first);
                         if (findObjMgr == objectMgrPaths.end())
                         {
-                            BMCWEB_LOG_DEBUG << connectionGroup.first
-                                             << "Has no Object Manager";
+                            BMCWEB_LOG_DEBUG("{}Has no Object Manager",
+                                             connectionGroup.first);
                             continue;
                         }
 
@@ -1363,7 +1360,7 @@
                    const dbus::utility::ManagedObjectType& mObj) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "Error communicating to Entity Manager";
+                BMCWEB_LOG_ERROR("Error communicating to Entity Manager");
                 messages::internalError(self->asyncResp->res);
                 return;
             }
@@ -1400,7 +1397,7 @@
             if (subtree[0].second.empty())
             {
                 // invalid mapper response, should never happen
-                BMCWEB_LOG_ERROR << "SetPIDValues: Mapper Error";
+                BMCWEB_LOG_ERROR("SetPIDValues: Mapper Error");
                 messages::internalError(self->asyncResp->res);
                 return;
             }
@@ -1413,8 +1410,8 @@
                                     const dbus::utility::DBusPropertiesMap& r) {
                 if (ec2)
                 {
-                    BMCWEB_LOG_ERROR
-                        << "SetPIDValues: Can't get thermalModeIface " << path;
+                    BMCWEB_LOG_ERROR(
+                        "SetPIDValues: Can't get thermalModeIface {}", path);
                     messages::internalError(self->asyncResp->res);
                     return;
                 }
@@ -1433,8 +1430,8 @@
 
                 if (current == nullptr || supported == nullptr)
                 {
-                    BMCWEB_LOG_ERROR
-                        << "SetPIDValues: thermal mode iface invalid " << path;
+                    BMCWEB_LOG_ERROR(
+                        "SetPIDValues: thermal mode iface invalid {}", path);
                     messages::internalError(self->asyncResp->res);
                     return;
                 }
@@ -1468,7 +1465,7 @@
                 [response](const boost::system::error_code& ec) {
                 if (ec)
                 {
-                    BMCWEB_LOG_ERROR << "Error patching profile" << ec;
+                    BMCWEB_LOG_ERROR("Error patching profile{}", ec);
                     messages::internalError(response->res);
                 }
                 });
@@ -1481,7 +1478,7 @@
             {
                 continue;
             }
-            BMCWEB_LOG_DEBUG << *container;
+            BMCWEB_LOG_DEBUG("{}", *container);
 
             const std::string& type = containerPair.first;
 
@@ -1491,7 +1488,7 @@
                 const auto& name = it.key();
                 std::string dbusObjName = name;
                 std::replace(dbusObjName.begin(), dbusObjName.end(), ' ', '_');
-                BMCWEB_LOG_DEBUG << "looking for " << name;
+                BMCWEB_LOG_DEBUG("looking for {}", name);
 
                 auto pathItr = std::find_if(managedObj.begin(),
                                             managedObj.end(),
@@ -1506,7 +1503,7 @@
                 // determines if we're patching entity-manager or
                 // creating a new object
                 bool createNewObject = (pathItr == managedObj.end());
-                BMCWEB_LOG_DEBUG << "Found = " << !createNewObject;
+                BMCWEB_LOG_DEBUG("Found = {}", !createNewObject);
 
                 std::string iface;
                 if (!createNewObject)
@@ -1565,7 +1562,7 @@
                     path = pathItr->first.str;
                 }
 
-                BMCWEB_LOG_DEBUG << "Create new = " << createNewObject << "\n";
+                BMCWEB_LOG_DEBUG("Create new = {}", createNewObject);
 
                 // arbitrary limit to avoid attacks
                 constexpr const size_t controllerLimit = 500;
@@ -1604,8 +1601,8 @@
                                 const boost::system::error_code& ec) {
                             if (ec)
                             {
-                                BMCWEB_LOG_ERROR << "Error patching "
-                                                 << propertyName << ": " << ec;
+                                BMCWEB_LOG_ERROR("Error patching {}: {}",
+                                                 propertyName, ec);
                                 messages::internalError(response->res);
                                 return;
                             }
@@ -1617,7 +1614,7 @@
                 {
                     if (chassis.empty())
                     {
-                        BMCWEB_LOG_ERROR << "Failed to get chassis from config";
+                        BMCWEB_LOG_ERROR("Failed to get chassis from config");
                         messages::internalError(response->res);
                         return;
                     }
@@ -1634,7 +1631,7 @@
                     }
                     if (!foundChassis)
                     {
-                        BMCWEB_LOG_ERROR << "Failed to find chassis on dbus";
+                        BMCWEB_LOG_ERROR("Failed to find chassis on dbus");
                         messages::resourceMissingAtURI(
                             response->res,
                             boost::urls::format("/redfish/v1/Chassis/{}",
@@ -1646,8 +1643,7 @@
                         [response](const boost::system::error_code& ec) {
                         if (ec)
                         {
-                            BMCWEB_LOG_ERROR << "Error Adding Pid Object "
-                                             << ec;
+                            BMCWEB_LOG_ERROR("Error Adding Pid Object {}", ec);
                             messages::internalError(response->res);
                             return;
                         }
@@ -1668,7 +1664,7 @@
         }
         catch (...)
         {
-            BMCWEB_LOG_CRITICAL << "pidSetDone threw exception";
+            BMCWEB_LOG_CRITICAL("pidSetDone threw exception");
         }
     }
 
@@ -1696,7 +1692,7 @@
                         const std::string& connectionName,
                         const std::string& path)
 {
-    BMCWEB_LOG_DEBUG << "Get BMC manager Location data.";
+    BMCWEB_LOG_DEBUG("Get BMC manager Location data.");
 
     sdbusplus::asio::getProperty<std::string>(
         *crow::connections::systemBus, connectionName, path,
@@ -1705,8 +1701,8 @@
                     const std::string& property) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error for "
-                                "Location";
+            BMCWEB_LOG_DEBUG("DBUS response error for "
+                             "Location");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -1719,7 +1715,7 @@
 inline void
     managerGetLastResetTime(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
-    BMCWEB_LOG_DEBUG << "Getting Manager Last Reset Time";
+    BMCWEB_LOG_DEBUG("Getting Manager Last Reset Time");
 
     sdbusplus::asio::getProperty<uint64_t>(
         *crow::connections::systemBus, "xyz.openbmc_project.State.BMC",
@@ -1729,7 +1725,7 @@
                     const uint64_t lastResetTime) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "D-BUS response error " << ec;
+            BMCWEB_LOG_DEBUG("D-BUS response error {}", ec);
             return;
         }
 
@@ -1761,7 +1757,7 @@
     {
         messages::propertyValueNotInList(asyncResp->res, runningFirmwareTarget,
                                          "@odata.id");
-        BMCWEB_LOG_DEBUG << "Can't parse firmware ID!";
+        BMCWEB_LOG_DEBUG("Can't parse firmware ID!");
         return;
     }
     idPos++;
@@ -1769,7 +1765,7 @@
     {
         messages::propertyValueNotInList(asyncResp->res, runningFirmwareTarget,
                                          "@odata.id");
-        BMCWEB_LOG_DEBUG << "Invalid firmware ID.";
+        BMCWEB_LOG_DEBUG("Invalid firmware ID.");
         return;
     }
     std::string firmwareId = runningFirmwareTarget.substr(idPos);
@@ -1783,14 +1779,14 @@
             const dbus::utility::ManagedObjectType& subtree) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "D-Bus response error getting objects.";
+            BMCWEB_LOG_DEBUG("D-Bus response error getting objects.");
             messages::internalError(asyncResp->res);
             return;
         }
 
         if (subtree.empty())
         {
-            BMCWEB_LOG_DEBUG << "Can't find image!";
+            BMCWEB_LOG_DEBUG("Can't find image!");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -1824,12 +1820,12 @@
         {
             messages::propertyValueNotInList(
                 asyncResp->res, runningFirmwareTarget, "@odata.id");
-            BMCWEB_LOG_DEBUG << "Invalid firmware ID.";
+            BMCWEB_LOG_DEBUG("Invalid firmware ID.");
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "Setting firmware version " << firmwareId
-                         << " to priority 0.";
+        BMCWEB_LOG_DEBUG("Setting firmware version {} to priority 0.",
+                         firmwareId);
 
         // Only support Immediate
         // An addition could be a Redfish Setting like
@@ -1843,7 +1839,7 @@
             [asyncResp](const boost::system::error_code& ec2) {
             if (ec2)
             {
-                BMCWEB_LOG_DEBUG << "D-Bus response error setting.";
+                BMCWEB_LOG_DEBUG("D-Bus response error setting.");
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -1855,7 +1851,7 @@
 inline void setDateTime(std::shared_ptr<bmcweb::AsyncResp> asyncResp,
                         std::string datetime)
 {
-    BMCWEB_LOG_DEBUG << "Set date time: " << datetime;
+    BMCWEB_LOG_DEBUG("Set date time: {}", datetime);
 
     std::optional<redfish::time_utils::usSinceEpoch> us =
         redfish::time_utils::dateStringToEpoch(datetime);
@@ -1873,9 +1869,9 @@
          datetime{std::move(datetime)}](const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "Failed to set elapsed time. "
-                                "DBUS response error "
-                             << ec;
+            BMCWEB_LOG_DEBUG("Failed to set elapsed time. "
+                             "DBUS response error {}",
+                             ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -2058,7 +2054,7 @@
             [asyncResp](const boost::system::error_code& ec, double val) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "Error while getting progress";
+                BMCWEB_LOG_ERROR("Error while getting progress");
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -2080,26 +2076,26 @@
                 const dbus::utility::MapperGetSubTreeResponse& subtree) {
             if (ec)
             {
-                BMCWEB_LOG_DEBUG << "D-Bus response error on GetSubTree " << ec;
+                BMCWEB_LOG_DEBUG("D-Bus response error on GetSubTree {}", ec);
                 return;
             }
             if (subtree.empty())
             {
-                BMCWEB_LOG_DEBUG << "Can't find bmc D-Bus object!";
+                BMCWEB_LOG_DEBUG("Can't find bmc D-Bus object!");
                 return;
             }
             // Assume only 1 bmc D-Bus object
             // Throw an error if there is more than 1
             if (subtree.size() > 1)
             {
-                BMCWEB_LOG_DEBUG << "Found more than 1 bmc D-Bus object!";
+                BMCWEB_LOG_DEBUG("Found more than 1 bmc D-Bus object!");
                 messages::internalError(asyncResp->res);
                 return;
             }
 
             if (subtree[0].first.empty() || subtree[0].second.size() != 1)
             {
-                BMCWEB_LOG_DEBUG << "Error getting bmc D-Bus object!";
+                BMCWEB_LOG_DEBUG("Error getting bmc D-Bus object!");
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -2120,7 +2116,7 @@
                                         propertiesList) {
                         if (ec2)
                         {
-                            BMCWEB_LOG_DEBUG << "Can't get bmc asset!";
+                            BMCWEB_LOG_DEBUG("Can't get bmc asset!");
                             return;
                         }
 
diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp
index 54b4cca..551a579 100644
--- a/redfish-core/lib/memory.hpp
+++ b/redfish-core/lib/memory.hpp
@@ -614,7 +614,7 @@
         health->populate();
     }
 
-    BMCWEB_LOG_DEBUG << "Get available system components.";
+    BMCWEB_LOG_DEBUG("Get available system components.");
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, service, objPath, "",
         [dimmId, asyncResp{std::move(asyncResp)}](
@@ -622,7 +622,7 @@
             const dbus::utility::DBusPropertiesMap& properties) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error";
+            BMCWEB_LOG_DEBUG("DBUS response error");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -695,7 +695,7 @@
             const dbus::utility::DBusPropertiesMap& properties) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error";
+            BMCWEB_LOG_DEBUG("DBUS response error");
             messages::internalError(asyncResp->res);
 
             return;
@@ -710,7 +710,7 @@
 inline void getDimmData(std::shared_ptr<bmcweb::AsyncResp> asyncResp,
                         const std::string& dimmId)
 {
-    BMCWEB_LOG_DEBUG << "Get available system dimm resources.";
+    BMCWEB_LOG_DEBUG("Get available system dimm resources.");
     constexpr std::array<std::string_view, 2> dimmInterfaces = {
         "xyz.openbmc_project.Inventory.Item.Dimm",
         "xyz.openbmc_project.Inventory.Item.PersistentMemory.Partition"};
@@ -721,7 +721,7 @@
             const dbus::utility::MapperGetSubTreeResponse& subtree) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error";
+            BMCWEB_LOG_DEBUG("DBUS response error");
             messages::internalError(asyncResp->res);
 
             return;
diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp
index 6f26d8a..7543186 100644
--- a/redfish-core/lib/metric_report.hpp
+++ b/redfish-core/lib/metric_report.hpp
@@ -108,7 +108,7 @@
             }
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
+                BMCWEB_LOG_ERROR("respHandler DBus error {}", ec);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -120,7 +120,7 @@
                                 const telemetry::TimestampReadings& ret) {
                 if (ec2)
                 {
-                    BMCWEB_LOG_ERROR << "respHandler DBus error " << ec2;
+                    BMCWEB_LOG_ERROR("respHandler DBus error {}", ec2);
                     messages::internalError(asyncResp->res);
                     return;
                 }
diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp
index e245a99..5daaeba 100644
--- a/redfish-core/lib/metric_report_definition.hpp
+++ b/redfish-core/lib/metric_report_definition.hpp
@@ -191,16 +191,16 @@
         if (path.parent_path() !=
             "/xyz/openbmc_project/Telemetry/Triggers/TelemetryService")
         {
-            BMCWEB_LOG_ERROR << "Property Triggers contains invalid value: "
-                             << path.str;
+            BMCWEB_LOG_ERROR("Property Triggers contains invalid value: {}",
+                             path.str);
             return std::nullopt;
         }
 
         std::string id = path.filename();
         if (id.empty())
         {
-            BMCWEB_LOG_ERROR << "Property Triggers contains invalid value: "
-                             << path.str;
+            BMCWEB_LOG_ERROR("Property Triggers contains invalid value: {}",
+                             path.str);
             return std::nullopt;
         }
         nlohmann::json::object_t trigger;
@@ -666,9 +666,9 @@
                 auto el = uriToDbus.find(uri);
                 if (el == uriToDbus.end())
                 {
-                    BMCWEB_LOG_ERROR
-                        << "Failed to find DBus sensor corresponding to URI "
-                        << uri;
+                    BMCWEB_LOG_ERROR(
+                        "Failed to find DBus sensor corresponding to URI {}",
+                        uri);
                     messages::propertyValueNotInList(asyncResp->res, uri,
                                                      "MetricProperties/" +
                                                          std::to_string(i));
@@ -712,7 +712,7 @@
             if (ec)
             {
                 messages::internalError(asyncResp->res);
-                BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
+                BMCWEB_LOG_ERROR("respHandler DBus error {}", ec);
                 return;
             }
 
@@ -819,7 +819,7 @@
         }
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
+            BMCWEB_LOG_ERROR("respHandler DBus error {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -855,7 +855,7 @@
 
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
+            BMCWEB_LOG_ERROR("respHandler DBus error {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -913,9 +913,9 @@
                     const std::map<std::string, std::string>& uriToDbus) {
                 if (status != boost::beast::http::status::ok)
                 {
-                    BMCWEB_LOG_ERROR
-                        << "Failed to retrieve URI to dbus sensors map with err "
-                        << static_cast<unsigned>(status);
+                    BMCWEB_LOG_ERROR(
+                        "Failed to retrieve URI to dbus sensors map with err {}",
+                        static_cast<unsigned>(status));
                     return;
                 }
                 addReportReq->insert(uriToDbus);
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp
index 29da308..83b6b66 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -351,7 +351,7 @@
             const dbus::utility::MapperGetSubTreeResponse& subtree) {
         if (ec)
         {
-            BMCWEB_LOG_WARNING << "D-Bus error: " << ec << ", " << ec.message();
+            BMCWEB_LOG_WARNING("D-Bus error: {}, {}", ec, ec.message());
             messages::internalError(asyncResp->res);
             return;
         }
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index e442c8e..3831e18 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -62,7 +62,7 @@
                        const dbus::utility::MapperGetObject& object) {
             if (ec || object.empty())
             {
-                BMCWEB_LOG_ERROR << "DBUS response error " << ec;
+                BMCWEB_LOG_ERROR("DBUS response error {}", ec);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -71,7 +71,7 @@
         return;
     }
 
-    BMCWEB_LOG_WARNING << "PCIe Device not found";
+    BMCWEB_LOG_WARNING("PCIe Device not found");
     messages::resourceNotFound(asyncResp->res, "PCIeDevice", pcieDeviceId);
 }
 
@@ -89,7 +89,7 @@
                        pcieDevicePaths) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "D-Bus response error on GetSubTree " << ec;
+            BMCWEB_LOG_ERROR("D-Bus response error on GetSubTree {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -154,8 +154,8 @@
 {
     if (ec)
     {
-        BMCWEB_LOG_ERROR << "DBUS response error for getAllProperties"
-                         << ec.value();
+        BMCWEB_LOG_ERROR("DBUS response error for getAllProperties{}",
+                         ec.value());
         messages::internalError(res);
         return;
     }
@@ -177,13 +177,13 @@
         pcie_util::redfishPcieGenerationFromDbus(generation);
     if (!pcieType)
     {
-        BMCWEB_LOG_WARNING << "Unknown PCIeType: " << generation;
+        BMCWEB_LOG_WARNING("Unknown PCIeType: {}", generation);
     }
     else
     {
         if (*pcieType == pcie_device::PCIeTypes::Invalid)
         {
-            BMCWEB_LOG_ERROR << "Invalid PCIeType: " << generation;
+            BMCWEB_LOG_ERROR("Invalid PCIeType: {}", generation);
             messages::internalError(res);
             return;
         }
@@ -199,13 +199,13 @@
         pcie_util::dbusSlotTypeToRf(slotType);
     if (!redfishSlotType)
     {
-        BMCWEB_LOG_WARNING << "Unknown PCIeSlot Type: " << slotType;
+        BMCWEB_LOG_WARNING("Unknown PCIeSlot Type: {}", slotType);
     }
     else
     {
         if (*redfishSlotType == pcie_slots::SlotTypes::Invalid)
         {
-            BMCWEB_LOG_ERROR << "Invalid PCIeSlot type: " << slotType;
+            BMCWEB_LOG_ERROR("Invalid PCIeSlot type: {}", slotType);
             messages::internalError(res);
             return;
         }
@@ -232,17 +232,17 @@
                 // Missing association is not an error
                 return;
             }
-            BMCWEB_LOG_ERROR
-                << "DBUS response error for getAssociatedSubTreePaths "
-                << ec.value();
+            BMCWEB_LOG_ERROR(
+                "DBUS response error for getAssociatedSubTreePaths {}",
+                ec.value());
             messages::internalError(asyncResp->res);
             return;
         }
         if (endpoints.size() > 1)
         {
-            BMCWEB_LOG_ERROR
-                << "PCIeDevice is associated with more than one PCIeSlot: "
-                << endpoints.size();
+            BMCWEB_LOG_ERROR(
+                "PCIeDevice is associated with more than one PCIeSlot: {}",
+                endpoints.size());
             messages::internalError(asyncResp->res);
             return;
         }
@@ -250,7 +250,7 @@
         {
             // If the device doesn't have an association, return without PCIe
             // Slot properties
-            BMCWEB_LOG_DEBUG << "PCIeDevice is not associated with PCIeSlot";
+            BMCWEB_LOG_DEBUG("PCIeDevice is not associated with PCIeSlot");
             return;
         }
         callback(endpoints[0]);
@@ -265,8 +265,8 @@
 {
     if (ec || object.empty())
     {
-        BMCWEB_LOG_ERROR << "DBUS response error for getDbusObject "
-                         << ec.value();
+        BMCWEB_LOG_ERROR("DBUS response error for getDbusObject {}",
+                         ec.value());
         messages::internalError(asyncResp->res);
         return;
     }
@@ -306,8 +306,8 @@
         {
             if (ec.value() != EBADR)
             {
-                BMCWEB_LOG_ERROR << "DBUS response error for Health "
-                                 << ec.value();
+                BMCWEB_LOG_ERROR("DBUS response error for Health {}",
+                                 ec.value());
                 messages::internalError(asyncResp->res);
             }
             return;
@@ -333,7 +333,7 @@
         {
             if (ec.value() != EBADR)
             {
-                BMCWEB_LOG_ERROR << "DBUS response error for State";
+                BMCWEB_LOG_ERROR("DBUS response error for State");
                 messages::internalError(asyncResp->res);
             }
             return;
@@ -361,8 +361,8 @@
         {
             if (ec.value() != EBADR)
             {
-                BMCWEB_LOG_ERROR << "DBUS response error for Properties"
-                                 << ec.value();
+                BMCWEB_LOG_ERROR("DBUS response error for Properties{}",
+                                 ec.value());
                 messages::internalError(asyncResp->res);
             }
             return;
@@ -439,15 +439,15 @@
 
         if (!redfishGenerationInUse)
         {
-            BMCWEB_LOG_WARNING << "Unknown PCIe Device Generation: "
-                               << *generationInUse;
+            BMCWEB_LOG_WARNING("Unknown PCIe Device Generation: {}",
+                               *generationInUse);
         }
         else
         {
             if (*redfishGenerationInUse == pcie_device::PCIeTypes::Invalid)
             {
-                BMCWEB_LOG_ERROR << "Invalid PCIe Device Generation: "
-                                 << *generationInUse;
+                BMCWEB_LOG_ERROR("Invalid PCIe Device Generation: {}",
+                                 *generationInUse);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -463,15 +463,15 @@
 
         if (!redfishGenerationSupported)
         {
-            BMCWEB_LOG_WARNING << "Unknown PCIe Device Generation: "
-                               << *generationSupported;
+            BMCWEB_LOG_WARNING("Unknown PCIe Device Generation: {}",
+                               *generationSupported);
         }
         else
         {
             if (*redfishGenerationSupported == pcie_device::PCIeTypes::Invalid)
             {
-                BMCWEB_LOG_ERROR << "Invalid PCIe Device Generation: "
-                                 << *generationSupported;
+                BMCWEB_LOG_ERROR("Invalid PCIe Device Generation: {}",
+                                 *generationSupported);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -515,7 +515,7 @@
         {
             if (ec.value() != EBADR)
             {
-                BMCWEB_LOG_ERROR << "DBUS response error for Properties";
+                BMCWEB_LOG_ERROR("DBUS response error for Properties");
                 messages::internalError(asyncResp->res);
             }
             return;
diff --git a/redfish-core/lib/pcie_slots.hpp b/redfish-core/lib/pcie_slots.hpp
index 4412c41..92ae576 100644
--- a/redfish-core/lib/pcie_slots.hpp
+++ b/redfish-core/lib/pcie_slots.hpp
@@ -29,7 +29,7 @@
 {
     if (ec)
     {
-        BMCWEB_LOG_ERROR << "Can't get PCIeSlot properties!";
+        BMCWEB_LOG_ERROR("Can't get PCIeSlot properties!");
         messages::internalError(asyncResp->res);
         return;
     }
@@ -40,7 +40,7 @@
         slots.get_ptr<nlohmann::json::array_t*>();
     if (slotsPtr == nullptr)
     {
-        BMCWEB_LOG_ERROR << "Slots key isn't an array???";
+        BMCWEB_LOG_ERROR("Slots key isn't an array???");
         messages::internalError(asyncResp->res);
         return;
     }
@@ -69,8 +69,7 @@
             pcie_util::redfishPcieGenerationFromDbus(*generation);
         if (!pcieType)
         {
-            BMCWEB_LOG_WARNING << "Unknown PCIe Slot Generation: "
-                               << *generation;
+            BMCWEB_LOG_WARNING("Unknown PCIe Slot Generation: {}", *generation);
         }
         else
         {
@@ -94,13 +93,13 @@
             pcie_util::dbusSlotTypeToRf(*slotType);
         if (!redfishSlotType)
         {
-            BMCWEB_LOG_WARNING << "Unknown PCIe Slot Type: " << *slotType;
+            BMCWEB_LOG_WARNING("Unknown PCIe Slot Type: {}", *slotType);
         }
         else
         {
             if (*redfishSlotType == pcie_slots::SlotTypes::Invalid)
             {
-                BMCWEB_LOG_ERROR << "Unknown PCIe Slot Type: " << *slotType;
+                BMCWEB_LOG_ERROR("Unknown PCIe Slot Type: {}", *slotType);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -129,14 +128,14 @@
             // This PCIeSlot have no chassis association.
             return;
         }
-        BMCWEB_LOG_ERROR << "DBUS response error";
+        BMCWEB_LOG_ERROR("DBUS response error");
         messages::internalError(asyncResp->res);
         return;
     }
 
     if (pcieSlotChassis.size() != 1)
     {
-        BMCWEB_LOG_ERROR << "PCIe Slot association error! ";
+        BMCWEB_LOG_ERROR("PCIe Slot association error! ");
         messages::internalError(asyncResp->res);
         return;
     }
@@ -166,7 +165,7 @@
 {
     if (ec)
     {
-        BMCWEB_LOG_ERROR << "D-Bus response error on GetSubTree " << ec;
+        BMCWEB_LOG_ERROR("D-Bus response error on GetSubTree {}", ec);
         messages::internalError(asyncResp->res);
         return;
     }
@@ -176,8 +175,8 @@
         return;
     }
 
-    BMCWEB_LOG_DEBUG << "Get properties for PCIeSlots associated to chassis = "
-                     << chassisID;
+    BMCWEB_LOG_DEBUG("Get properties for PCIeSlots associated to chassis = {}",
+                     chassisID);
 
     asyncResp->res.jsonValue["@odata.type"] = "#PCIeSlots.v1_4_1.PCIeSlots";
     asyncResp->res.jsonValue["Name"] = "PCIe Slot Information";
diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp
index f9063b7..e7094ad 100644
--- a/redfish-core/lib/power.hpp
+++ b/redfish-core/lib/power.hpp
@@ -39,7 +39,7 @@
             const std::optional<std::string>& chassisPath) mutable {
         if (!chassisPath)
         {
-            BMCWEB_LOG_WARNING << "Don't find valid chassis path ";
+            BMCWEB_LOG_WARNING("Don't find valid chassis path ");
             messages::resourceNotFound(sensorsAsyncResp->asyncResp->res,
                                        "Chassis", sensorsAsyncResp->chassisId);
             return;
@@ -47,7 +47,7 @@
 
         if (powerControlCollections.size() != 1)
         {
-            BMCWEB_LOG_WARNING << "Don't support multiple hosts at present ";
+            BMCWEB_LOG_WARNING("Don't support multiple hosts at present ");
             messages::resourceNotFound(sensorsAsyncResp->asyncResp->res,
                                        "Power", "PowerControl");
             return;
@@ -84,8 +84,8 @@
             if (ec)
             {
                 messages::internalError(sensorsAsyncResp->asyncResp->res);
-                BMCWEB_LOG_ERROR << "powerCapEnable Get handler: Dbus error "
-                                 << ec;
+                BMCWEB_LOG_ERROR("powerCapEnable Get handler: Dbus error {}",
+                                 ec);
                 return;
             }
             if (!powerCapEnable)
@@ -93,7 +93,7 @@
                 messages::actionNotSupported(
                     sensorsAsyncResp->asyncResp->res,
                     "Setting LimitInWatts when PowerLimit feature is disabled");
-                BMCWEB_LOG_ERROR << "PowerLimit feature is disabled ";
+                BMCWEB_LOG_ERROR("PowerLimit feature is disabled ");
                 return;
             }
 
@@ -104,7 +104,7 @@
                 [sensorsAsyncResp](const boost::system::error_code& ec2) {
                 if (ec2)
                 {
-                    BMCWEB_LOG_DEBUG << "Power Limit Set: Dbus error: " << ec2;
+                    BMCWEB_LOG_DEBUG("Power Limit Set: Dbus error: {}", ec2);
                     messages::internalError(sensorsAsyncResp->asyncResp->res);
                     return;
                 }
@@ -148,8 +148,8 @@
                               const Mapper& chassisPaths) {
             if (ec2)
             {
-                BMCWEB_LOG_ERROR
-                    << "Power Limit GetSubTreePaths handler Dbus error " << ec2;
+                BMCWEB_LOG_ERROR(
+                    "Power Limit GetSubTreePaths handler Dbus error {}", ec2);
                 return;
             }
 
@@ -186,8 +186,8 @@
 
             if (!found)
             {
-                BMCWEB_LOG_DEBUG << "Power Limit not present for "
-                                 << sensorAsyncResp->chassisId;
+                BMCWEB_LOG_DEBUG("Power Limit not present for {}",
+                                 sensorAsyncResp->chassisId);
                 return;
             }
 
@@ -198,8 +198,8 @@
                 if (ec)
                 {
                     messages::internalError(sensorAsyncResp->asyncResp->res);
-                    BMCWEB_LOG_ERROR
-                        << "Power Limit GetAll handler: Dbus error " << ec;
+                    BMCWEB_LOG_ERROR(
+                        "Power Limit GetAll handler: Dbus error {}", ec);
                     return;
                 }
 
diff --git a/redfish-core/lib/power_supply.hpp b/redfish-core/lib/power_supply.hpp
index 09f731b..0035b11 100644
--- a/redfish-core/lib/power_supply.hpp
+++ b/redfish-core/lib/power_supply.hpp
@@ -82,7 +82,7 @@
         {
             if (ec.value() != EBADR)
             {
-                BMCWEB_LOG_ERROR << "DBUS response error" << ec.value();
+                BMCWEB_LOG_ERROR("DBUS response error{}", ec.value());
                 messages::internalError(asyncResp->res);
             }
             return;
@@ -171,9 +171,9 @@
         {
             if (ec.value() != EBADR)
             {
-                BMCWEB_LOG_ERROR
-                    << "DBUS response error for getAssociatedSubTreePaths"
-                    << ec.value();
+                BMCWEB_LOG_ERROR(
+                    "DBUS response error for getAssociatedSubTreePaths{}",
+                    ec.value());
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -193,7 +193,7 @@
 
         if (!subtreePaths.empty())
         {
-            BMCWEB_LOG_WARNING << "Power supply not found: " << powerSupplyId;
+            BMCWEB_LOG_WARNING("Power supply not found: {}", powerSupplyId);
             messages::resourceNotFound(asyncResp->res, "PowerSupplies",
                                        powerSupplyId);
             return;
@@ -213,8 +213,8 @@
         {
             if (ec.value() != EBADR)
             {
-                BMCWEB_LOG_ERROR << "DBUS response error for State "
-                                 << ec.value();
+                BMCWEB_LOG_ERROR("DBUS response error for State {}",
+                                 ec.value());
                 messages::internalError(asyncResp->res);
             }
             return;
@@ -239,8 +239,8 @@
         {
             if (ec.value() != EBADR)
             {
-                BMCWEB_LOG_ERROR << "DBUS response error for Health "
-                                 << ec.value();
+                BMCWEB_LOG_ERROR("DBUS response error for Health {}",
+                                 ec.value());
                 messages::internalError(asyncResp->res);
             }
             return;
@@ -266,8 +266,8 @@
         {
             if (ec.value() != EBADR)
             {
-                BMCWEB_LOG_ERROR << "DBUS response error for Asset "
-                                 << ec.value();
+                BMCWEB_LOG_ERROR("DBUS response error for Asset {}",
+                                 ec.value());
                 messages::internalError(asyncResp->res);
             }
             return;
@@ -331,8 +331,8 @@
         {
             if (ec.value() != EBADR)
             {
-                BMCWEB_LOG_ERROR << "DBUS response error for FirmwareVersion "
-                                 << ec.value();
+                BMCWEB_LOG_ERROR("DBUS response error for FirmwareVersion {}",
+                                 ec.value());
                 messages::internalError(asyncResp->res);
             }
             return;
@@ -354,8 +354,8 @@
         {
             if (ec.value() != EBADR)
             {
-                BMCWEB_LOG_ERROR << "DBUS response error for Location "
-                                 << ec.value();
+                BMCWEB_LOG_ERROR("DBUS response error for Location {}",
+                                 ec.value());
                 messages::internalError(asyncResp->res);
             }
             return;
@@ -373,8 +373,8 @@
     {
         if (ec.value() != EBADR)
         {
-            BMCWEB_LOG_ERROR << "DBUS response error for DeratingFactor "
-                             << ec.value();
+            BMCWEB_LOG_ERROR("DBUS response error for DeratingFactor {}",
+                             ec.value());
             messages::internalError(asyncResp->res);
         }
         return;
@@ -402,8 +402,8 @@
     {
         if (ec.value() != EBADR)
         {
-            BMCWEB_LOG_ERROR << "DBUS response error for EfficiencyPercent "
-                             << ec.value();
+            BMCWEB_LOG_ERROR("DBUS response error for EfficiencyPercent {}",
+                             ec.value());
             messages::internalError(asyncResp->res);
         }
         return;
@@ -411,15 +411,15 @@
 
     if (subtree.empty())
     {
-        BMCWEB_LOG_DEBUG << "Can't find Power Supply Attributes!";
+        BMCWEB_LOG_DEBUG("Can't find Power Supply Attributes!");
         return;
     }
 
     if (subtree.size() != 1)
     {
-        BMCWEB_LOG_ERROR
-            << "Unexpected number of paths returned by getSubTree: "
-            << subtree.size();
+        BMCWEB_LOG_ERROR(
+            "Unexpected number of paths returned by getSubTree: {}",
+            subtree.size());
         messages::internalError(asyncResp->res);
         return;
     }
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp
index 8efa78e..873f882 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -59,7 +59,7 @@
                              const std::string& service,
                              const std::string& objPath)
 {
-    BMCWEB_LOG_DEBUG << "Get Processor UUID";
+    BMCWEB_LOG_DEBUG("Get Processor UUID");
     sdbusplus::asio::getProperty<std::string>(
         *crow::connections::systemBus, service, objPath,
         "xyz.openbmc_project.Common.UUID", "UUID",
@@ -67,7 +67,7 @@
             const boost::system::error_code& ec, const std::string& property) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error";
+            BMCWEB_LOG_DEBUG("DBUS response error");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -79,7 +79,7 @@
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
     const dbus::utility::DBusInteracesMap& cpuInterfacesProperties)
 {
-    BMCWEB_LOG_DEBUG << "Get CPU resources by interface.";
+    BMCWEB_LOG_DEBUG("Get CPU resources by interface.");
 
     // Set the default value of state
     asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
@@ -223,7 +223,7 @@
                                 const std::string& service,
                                 const std::string& objPath)
 {
-    BMCWEB_LOG_DEBUG << "Get available system cpu resources by service.";
+    BMCWEB_LOG_DEBUG("Get available system cpu resources by service.");
 
     sdbusplus::message::object_path path("/xyz/openbmc_project/inventory");
     dbus::utility::getManagedObjects(
@@ -233,7 +233,7 @@
             const dbus::utility::ManagedObjectType& dbusData) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error";
+            BMCWEB_LOG_DEBUG("DBUS response error");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -339,7 +339,7 @@
 {
     if (ec)
     {
-        BMCWEB_LOG_ERROR << "Processor Throttle getAllProperties error " << ec;
+        BMCWEB_LOG_ERROR("Processor Throttle getAllProperties error {}", ec);
         messages::internalError(asyncResp->res);
         return;
     }
@@ -376,7 +376,7 @@
                           const std::string& service,
                           const std::string& objectPath)
 {
-    BMCWEB_LOG_DEBUG << "Get processor throttle resources";
+    BMCWEB_LOG_DEBUG("Get processor throttle resources");
 
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, service, objectPath,
@@ -391,7 +391,7 @@
                             const std::string& service,
                             const std::string& objPath)
 {
-    BMCWEB_LOG_DEBUG << "Get Cpu Asset Data";
+    BMCWEB_LOG_DEBUG("Get Cpu Asset Data");
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, service, objPath,
         "xyz.openbmc_project.Inventory.Decorator.Asset",
@@ -400,7 +400,7 @@
             const dbus::utility::DBusPropertiesMap& properties) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error";
+            BMCWEB_LOG_DEBUG("DBUS response error");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -465,7 +465,7 @@
                                const std::string& service,
                                const std::string& objPath)
 {
-    BMCWEB_LOG_DEBUG << "Get Cpu Revision Data";
+    BMCWEB_LOG_DEBUG("Get Cpu Revision Data");
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, service, objPath,
         "xyz.openbmc_project.Inventory.Decorator.Revision",
@@ -474,7 +474,7 @@
             const dbus::utility::DBusPropertiesMap& properties) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error";
+            BMCWEB_LOG_DEBUG("DBUS response error");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -501,8 +501,7 @@
     std::shared_ptr<bmcweb::AsyncResp> asyncResp, const std::string& acclrtrId,
     const std::string& service, const std::string& objPath)
 {
-    BMCWEB_LOG_DEBUG
-        << "Get available system Accelerator resources by service.";
+    BMCWEB_LOG_DEBUG("Get available system Accelerator resources by service.");
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, service, objPath, "",
         [acclrtrId, asyncResp{std::move(asyncResp)}](
@@ -510,7 +509,7 @@
             const dbus::utility::DBusPropertiesMap& properties) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error";
+            BMCWEB_LOG_DEBUG("DBUS response error");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -613,7 +612,7 @@
                      const std::string& cpuId, const std::string& service,
                      const std::string& objPath)
 {
-    BMCWEB_LOG_INFO << "Getting CPU operating configs for " << cpuId;
+    BMCWEB_LOG_INFO("Getting CPU operating configs for {}", cpuId);
 
     // First, GetAll CurrentOperatingConfig properties on the object
     sdbusplus::asio::getAllProperties(
@@ -624,7 +623,7 @@
                   const dbus::utility::DBusPropertiesMap& properties) {
         if (ec)
         {
-            BMCWEB_LOG_WARNING << "D-Bus error: " << ec << ", " << ec.message();
+            BMCWEB_LOG_WARNING("D-Bus error: {}, {}", ec, ec.message());
             messages::internalError(asyncResp->res);
             return;
         }
@@ -685,7 +684,7 @@
                     const BaseSpeedPrioritySettingsProperty& baseSpeedList) {
                 if (ec2)
                 {
-                    BMCWEB_LOG_WARNING << "D-Bus Property Get error: " << ec2;
+                    BMCWEB_LOG_WARNING("D-Bus Property Get error: {}", ec2);
                     messages::internalError(asyncResp->res);
                     return;
                 }
@@ -714,7 +713,7 @@
                                const std::string& service,
                                const std::string& objPath)
 {
-    BMCWEB_LOG_DEBUG << "Get Cpu Location Data";
+    BMCWEB_LOG_DEBUG("Get Cpu Location Data");
     sdbusplus::asio::getProperty<std::string>(
         *crow::connections::systemBus, service, objPath,
         "xyz.openbmc_project.Inventory.Decorator.LocationCode", "LocationCode",
@@ -722,7 +721,7 @@
             const boost::system::error_code& ec, const std::string& property) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error";
+            BMCWEB_LOG_DEBUG("DBUS response error");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -744,7 +743,7 @@
                            const std::string& service,
                            const std::string& objectPath)
 {
-    BMCWEB_LOG_DEBUG << "Get CPU UniqueIdentifier";
+    BMCWEB_LOG_DEBUG("Get CPU UniqueIdentifier");
     sdbusplus::asio::getProperty<std::string>(
         *crow::connections::systemBus, service, objectPath,
         "xyz.openbmc_project.Inventory.Decorator.UniqueIdentifier",
@@ -753,7 +752,7 @@
                     const std::string& id) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "Failed to read cpu unique id: " << ec;
+            BMCWEB_LOG_ERROR("Failed to read cpu unique id: {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -777,7 +776,7 @@
                                const std::string& processorId,
                                Handler&& handler)
 {
-    BMCWEB_LOG_DEBUG << "Get available system processor resources.";
+    BMCWEB_LOG_DEBUG("Get available system processor resources.");
 
     // GetSubTree on all interfaces which provide info about a Processor
     constexpr std::array<std::string_view, 9> interfaces = {
@@ -797,7 +796,7 @@
             const dbus::utility::MapperGetSubTreeResponse& subtree) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error: " << ec;
+            BMCWEB_LOG_DEBUG("DBUS response error: {}", ec);
             messages::internalError(resp->res);
             return;
         }
@@ -921,7 +920,7 @@
                     const dbus::utility::DBusPropertiesMap& properties) {
         if (ec)
         {
-            BMCWEB_LOG_WARNING << "D-Bus error: " << ec << ", " << ec.message();
+            BMCWEB_LOG_WARNING("D-Bus error: {}, {}", ec, ec.message());
             messages::internalError(asyncResp->res);
             return;
         }
@@ -1022,11 +1021,11 @@
 {
     if (!ec)
     {
-        BMCWEB_LOG_DEBUG << "Set Property succeeded";
+        BMCWEB_LOG_DEBUG("Set Property succeeded");
         return;
     }
 
-    BMCWEB_LOG_DEBUG << "Set Property failed: " << ec;
+    BMCWEB_LOG_DEBUG("Set Property failed: {}", ec);
 
     const sd_bus_error* dbusError = msg.get_error();
     if (dbusError == nullptr)
@@ -1119,7 +1118,7 @@
     sdbusplus::message::object_path configPath(cpuObjectPath);
     configPath /= configBaseName;
 
-    BMCWEB_LOG_INFO << "Setting config to " << configPath.str;
+    BMCWEB_LOG_INFO("Setting config to {}", configPath.str);
 
     // Set the property, with handler to check error responses
     sdbusplus::asio::setProperty(
@@ -1207,8 +1206,7 @@
                 const dbus::utility::MapperGetSubTreePathsResponse& objects) {
             if (ec)
             {
-                BMCWEB_LOG_WARNING << "D-Bus error: " << ec << ", "
-                                   << ec.message();
+                BMCWEB_LOG_WARNING("D-Bus error: {}, {}", ec, ec.message());
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -1281,8 +1279,7 @@
                 const dbus::utility::MapperGetSubTreeResponse& subtree) {
             if (ec)
             {
-                BMCWEB_LOG_WARNING << "D-Bus error: " << ec << ", "
-                                   << ec.message();
+                BMCWEB_LOG_WARNING("D-Bus error: {}, {}", ec, ec.message());
                 messages::internalError(asyncResp->res);
                 return;
             }
diff --git a/redfish-core/lib/redfish_util.hpp b/redfish-core/lib/redfish_util.hpp
index f5c68d1..fad410d 100644
--- a/redfish-core/lib/redfish_util.hpp
+++ b/redfish-core/lib/redfish_util.hpp
@@ -73,12 +73,12 @@
                     const dbus::utility::MapperGetSubTreeResponse& subtree) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << ec;
+            BMCWEB_LOG_ERROR("{}", ec);
             return;
         }
         if (subtree.empty())
         {
-            BMCWEB_LOG_DEBUG << "Can't find chassis!";
+            BMCWEB_LOG_DEBUG("Can't find chassis!");
             return;
         }
 
@@ -87,11 +87,11 @@
             (idPos + 1) >= subtree[0].first.size())
         {
             messages::internalError(asyncResp->res);
-            BMCWEB_LOG_DEBUG << "Can't parse chassis ID!";
+            BMCWEB_LOG_DEBUG("Can't parse chassis ID!");
             return;
         }
         std::string chassisId = subtree[0].first.substr(idPos + 1);
-        BMCWEB_LOG_DEBUG << "chassisId = " << chassisId;
+        BMCWEB_LOG_DEBUG("chassisId = {}", chassisId);
         callback(chassisId, asyncResp);
         });
 }
@@ -109,7 +109,7 @@
         std::vector<std::tuple<std::string, std::string, bool>> socketData;
         if (ec)
         {
-            BMCWEB_LOG_ERROR << ec;
+            BMCWEB_LOG_ERROR("{}", ec);
             // return error code
             callback(ec, socketData);
             return;
@@ -181,10 +181,9 @@
                     {
                         // Already registered as enabled or current one is not
                         // enabled, nothing to do
-                        BMCWEB_LOG_DEBUG
-                            << "protocolName: " << kv.first
-                            << ", already true or current one is false: "
-                            << isProtocolEnabled;
+                        BMCWEB_LOG_DEBUG(
+                            "protocolName: {}, already true or current one is false: {}",
+                            kv.first, isProtocolEnabled);
                         break;
                     }
                     // Remove existing entry and replace with new one (below)
@@ -216,7 +215,7 @@
             const std::vector<std::tuple<std::string, std::string>>& resp) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << ec;
+            BMCWEB_LOG_ERROR("{}", ec);
             callback(ec, 0);
             return;
         }
@@ -228,7 +227,7 @@
                     boost::system::errc::bad_message);
             // return error code
             callback(ec1, 0);
-            BMCWEB_LOG_ERROR << ec1;
+            BMCWEB_LOG_ERROR("{}", ec1);
             return;
         }
         const std::string& listenStream =
@@ -250,7 +249,7 @@
             }
             // return error code
             callback(ec3, 0);
-            BMCWEB_LOG_ERROR << ec3;
+            BMCWEB_LOG_ERROR("{}", ec3);
         }
         callback(ec, port);
         });
diff --git a/redfish-core/lib/redfish_v1.hpp b/redfish-core/lib/redfish_v1.hpp
index b7a1f4c..a591763 100644
--- a/redfish-core/lib/redfish_v1.hpp
+++ b/redfish-core/lib/redfish_v1.hpp
@@ -39,7 +39,7 @@
         return;
     }
 
-    BMCWEB_LOG_WARNING << "404 on path " << path;
+    BMCWEB_LOG_WARNING("404 on path {}", path);
 
     std::string name = req.url().segments().back();
     // Note, if we hit the wildcard route, we don't know the "type" the user was
@@ -59,7 +59,7 @@
         return;
     }
 
-    BMCWEB_LOG_WARNING << "405 on path " << path;
+    BMCWEB_LOG_WARNING("405 on path {}", path);
     asyncResp->res.result(boost::beast::http::status::method_not_allowed);
     if (req.method() == boost::beast::http::verb::delete_)
     {
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 1fec868..4969c8f 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -324,7 +324,7 @@
         name = path.filename();
         if (name.empty())
         {
-            BMCWEB_LOG_ERROR << "Failed to find '/' in " << objectPath;
+            BMCWEB_LOG_ERROR("Failed to find '/' in {}", objectPath);
         }
     }
 
@@ -355,7 +355,7 @@
     const std::shared_ptr<std::set<std::string>>& sensorNames,
     Callback&& callback)
 {
-    BMCWEB_LOG_DEBUG << "getObjectsWithConnection enter";
+    BMCWEB_LOG_DEBUG("getObjectsWithConnection enter");
     const std::string path = "/xyz/openbmc_project/sensors";
     constexpr std::array<std::string_view, 1> interfaces = {
         "xyz.openbmc_project.Sensor.Value"};
@@ -367,26 +367,26 @@
          sensorNames](const boost::system::error_code& ec,
                       const dbus::utility::MapperGetSubTreeResponse& subtree) {
         // Response handler for parsing objects subtree
-        BMCWEB_LOG_DEBUG << "getObjectsWithConnection resp_handler enter";
+        BMCWEB_LOG_DEBUG("getObjectsWithConnection resp_handler enter");
         if (ec)
         {
             messages::internalError(sensorsAsyncResp->asyncResp->res);
-            BMCWEB_LOG_ERROR
-                << "getObjectsWithConnection resp_handler: Dbus error " << ec;
+            BMCWEB_LOG_ERROR(
+                "getObjectsWithConnection resp_handler: Dbus error {}", ec);
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "Found " << subtree.size() << " subtrees";
+        BMCWEB_LOG_DEBUG("Found {} subtrees", subtree.size());
 
         // Make unique list of connections only for requested sensor types and
         // found in the chassis
         std::set<std::string> connections;
         std::set<std::pair<std::string, std::string>> objectsWithConnection;
 
-        BMCWEB_LOG_DEBUG << "sensorNames list count: " << sensorNames->size();
+        BMCWEB_LOG_DEBUG("sensorNames list count: {}", sensorNames->size());
         for (const std::string& tsensor : *sensorNames)
         {
-            BMCWEB_LOG_DEBUG << "Sensor to find: " << tsensor;
+            BMCWEB_LOG_DEBUG("Sensor to find: {}", tsensor);
         }
 
         for (const std::pair<
@@ -399,18 +399,18 @@
                 for (const std::pair<std::string, std::vector<std::string>>&
                          objData : object.second)
                 {
-                    BMCWEB_LOG_DEBUG << "Adding connection: " << objData.first;
+                    BMCWEB_LOG_DEBUG("Adding connection: {}", objData.first);
                     connections.insert(objData.first);
                     objectsWithConnection.insert(
                         std::make_pair(object.first, objData.first));
                 }
             }
         }
-        BMCWEB_LOG_DEBUG << "Found " << connections.size() << " connections";
+        BMCWEB_LOG_DEBUG("Found {} connections", connections.size());
         callback(std::move(connections), std::move(objectsWithConnection));
-        BMCWEB_LOG_DEBUG << "getObjectsWithConnection resp_handler exit";
+        BMCWEB_LOG_DEBUG("getObjectsWithConnection resp_handler exit");
         });
-    BMCWEB_LOG_DEBUG << "getObjectsWithConnection exit";
+    BMCWEB_LOG_DEBUG("getObjectsWithConnection exit");
 }
 
 /**
@@ -518,7 +518,7 @@
                 std::span<const std::string_view> sensorTypes,
                 Callback&& callback)
 {
-    BMCWEB_LOG_DEBUG << "getChassis enter";
+    BMCWEB_LOG_DEBUG("getChassis enter");
     constexpr std::array<std::string_view, 2> interfaces = {
         "xyz.openbmc_project.Inventory.Item.Board",
         "xyz.openbmc_project.Inventory.Item.Chassis"};
@@ -531,10 +531,10 @@
          chassisSubNode{std::string(chassisSubNode)}, sensorTypes](
             const boost::system::error_code& ec,
             const dbus::utility::MapperGetSubTreePathsResponse& chassisPaths) {
-        BMCWEB_LOG_DEBUG << "getChassis respHandler enter";
+        BMCWEB_LOG_DEBUG("getChassis respHandler enter");
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "getChassis respHandler DBUS error: " << ec;
+            BMCWEB_LOG_ERROR("getChassis respHandler DBUS error: {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -545,7 +545,7 @@
             std::string chassisName = path.filename();
             if (chassisName.empty())
             {
-                BMCWEB_LOG_ERROR << "Failed to find '/' in " << chassis;
+                BMCWEB_LOG_ERROR("Failed to find '/' in {}", chassis);
                 continue;
             }
             if (chassisName == chassisIdStr)
@@ -584,11 +584,11 @@
                 std::make_shared<std::set<std::string>>();
             reduceSensorList(asyncResp->res, chassisSubNode, sensorTypes,
                              &nodeSensorList, culledSensorList);
-            BMCWEB_LOG_DEBUG << "Finishing with " << culledSensorList->size();
+            BMCWEB_LOG_DEBUG("Finishing with {}", culledSensorList->size());
             callback(culledSensorList);
             });
         });
-    BMCWEB_LOG_DEBUG << "getChassis exit";
+    BMCWEB_LOG_DEBUG("getChassis exit");
 }
 
 /**
@@ -774,8 +774,8 @@
         sensor::ReadingType readingType = sensors::toReadingType(sensorType);
         if (readingType == sensor::ReadingType::Invalid)
         {
-            BMCWEB_LOG_ERROR << "Redfish cannot map reading type for "
-                             << sensorType;
+            BMCWEB_LOG_ERROR("Redfish cannot map reading type for {}",
+                             sensorType);
         }
         else
         {
@@ -785,8 +785,8 @@
         std::string_view readingUnits = sensors::toReadingUnits(sensorType);
         if (readingUnits.empty())
         {
-            BMCWEB_LOG_ERROR << "Redfish cannot map reading unit for "
-                             << sensorType;
+            BMCWEB_LOG_ERROR("Redfish cannot map reading unit for {}",
+                             sensorType);
         }
         else
         {
@@ -843,7 +843,7 @@
     }
     else
     {
-        BMCWEB_LOG_ERROR << "Redfish cannot map object type for " << sensorName;
+        BMCWEB_LOG_ERROR("Redfish cannot map object type for {}", sensorName);
         return;
     }
     // Map of dbus interface name, dbus property name and redfish property_name
@@ -928,7 +928,7 @@
             const double* doubleValue = std::get_if<double>(&valueVariant);
             if (doubleValue == nullptr)
             {
-                BMCWEB_LOG_ERROR << "Got value interface that wasn't double";
+                BMCWEB_LOG_ERROR("Got value interface that wasn't double");
                 continue;
             }
             if (!std::isfinite(*doubleValue))
@@ -940,8 +940,8 @@
                     sensorJson[key] = nullptr;
                     continue;
                 }
-                BMCWEB_LOG_WARNING << "Sensor value for " << valueName
-                                   << " was unexpectedly " << *doubleValue;
+                BMCWEB_LOG_WARNING("Sensor value for {} was unexpectedly {}",
+                                   valueName, *doubleValue);
                 continue;
             }
             if (forceToInt)
@@ -979,7 +979,7 @@
         objectPropertiesToJson(sensorName, sensorType, chassisSubNode,
                                valuesDict, sensorJson, inventoryItem);
     }
-    BMCWEB_LOG_DEBUG << "Added sensor " << sensorName;
+    BMCWEB_LOG_DEBUG("Added sensor {}", sensorName);
 }
 
 inline void populateFanRedundancy(
@@ -1059,7 +1059,7 @@
                     if (allowedFailures == nullptr || collection == nullptr ||
                         status == nullptr)
                     {
-                        BMCWEB_LOG_ERROR << "Invalid redundancy interface";
+                        BMCWEB_LOG_ERROR("Invalid redundancy interface");
                         messages::internalError(
                             sensorsAsyncResp->asyncResp->res);
                         return;
@@ -1120,7 +1120,7 @@
                         }
                         else
                         {
-                            BMCWEB_LOG_ERROR << "failed to find fan in schema";
+                            BMCWEB_LOG_ERROR("failed to find fan in schema");
                             messages::internalError(
                                 sensorsAsyncResp->asyncResp->res);
                             return;
@@ -1432,13 +1432,13 @@
     std::shared_ptr<std::set<std::string>> invConnections, Callback&& callback,
     size_t invConnectionsIndex = 0)
 {
-    BMCWEB_LOG_DEBUG << "getInventoryItemsData enter";
+    BMCWEB_LOG_DEBUG("getInventoryItemsData enter");
 
     // If no more connections left, call callback
     if (invConnectionsIndex >= invConnections->size())
     {
         callback();
-        BMCWEB_LOG_DEBUG << "getInventoryItemsData exit";
+        BMCWEB_LOG_DEBUG("getInventoryItemsData exit");
         return;
     }
 
@@ -1457,11 +1457,11 @@
              callback{std::forward<Callback>(callback)}, invConnectionsIndex](
                 const boost::system::error_code& ec,
                 const dbus::utility::ManagedObjectType& resp) {
-            BMCWEB_LOG_DEBUG << "getInventoryItemsData respHandler enter";
+            BMCWEB_LOG_DEBUG("getInventoryItemsData respHandler enter");
             if (ec)
             {
-                BMCWEB_LOG_ERROR
-                    << "getInventoryItemsData respHandler DBus error " << ec;
+                BMCWEB_LOG_ERROR(
+                    "getInventoryItemsData respHandler DBus error {}", ec);
                 messages::internalError(sensorsAsyncResp->asyncResp->res);
                 return;
             }
@@ -1487,11 +1487,11 @@
                                   invConnections, std::move(callback),
                                   invConnectionsIndex + 1);
 
-            BMCWEB_LOG_DEBUG << "getInventoryItemsData respHandler exit";
+            BMCWEB_LOG_DEBUG("getInventoryItemsData respHandler exit");
             });
     }
 
-    BMCWEB_LOG_DEBUG << "getInventoryItemsData exit";
+    BMCWEB_LOG_DEBUG("getInventoryItemsData exit");
 }
 
 /**
@@ -1518,7 +1518,7 @@
     const std::shared_ptr<std::vector<InventoryItem>>& inventoryItems,
     Callback&& callback)
 {
-    BMCWEB_LOG_DEBUG << "getInventoryItemsConnections enter";
+    BMCWEB_LOG_DEBUG("getInventoryItemsConnections enter");
 
     const std::string path = "/xyz/openbmc_project/inventory";
     constexpr std::array<std::string_view, 4> interfaces = {
@@ -1535,12 +1535,12 @@
             const boost::system::error_code& ec,
             const dbus::utility::MapperGetSubTreeResponse& subtree) {
         // Response handler for parsing output from GetSubTree
-        BMCWEB_LOG_DEBUG << "getInventoryItemsConnections respHandler enter";
+        BMCWEB_LOG_DEBUG("getInventoryItemsConnections respHandler enter");
         if (ec)
         {
             messages::internalError(sensorsAsyncResp->asyncResp->res);
-            BMCWEB_LOG_ERROR
-                << "getInventoryItemsConnections respHandler DBus error " << ec;
+            BMCWEB_LOG_ERROR(
+                "getInventoryItemsConnections respHandler DBus error {}", ec);
             return;
         }
 
@@ -1569,9 +1569,9 @@
         }
 
         callback(invConnections);
-        BMCWEB_LOG_DEBUG << "getInventoryItemsConnections respHandler exit";
+        BMCWEB_LOG_DEBUG("getInventoryItemsConnections respHandler exit");
         });
-    BMCWEB_LOG_DEBUG << "getInventoryItemsConnections exit";
+    BMCWEB_LOG_DEBUG("getInventoryItemsConnections exit");
 }
 
 /**
@@ -1600,7 +1600,7 @@
     const std::shared_ptr<std::set<std::string>>& sensorNames,
     Callback&& callback)
 {
-    BMCWEB_LOG_DEBUG << "getInventoryItemAssociations enter";
+    BMCWEB_LOG_DEBUG("getInventoryItemAssociations enter");
 
     // Call GetManagedObjects on the ObjectMapper to get all associations
     sdbusplus::message::object_path path("/");
@@ -1609,11 +1609,11 @@
         [callback{std::forward<Callback>(callback)}, sensorsAsyncResp,
          sensorNames](const boost::system::error_code& ec,
                       const dbus::utility::ManagedObjectType& resp) {
-        BMCWEB_LOG_DEBUG << "getInventoryItemAssociations respHandler enter";
+        BMCWEB_LOG_DEBUG("getInventoryItemAssociations respHandler enter");
         if (ec)
         {
-            BMCWEB_LOG_ERROR
-                << "getInventoryItemAssociations respHandler DBus error " << ec;
+            BMCWEB_LOG_ERROR(
+                "getInventoryItemAssociations respHandler DBus error {}", ec);
             messages::internalError(sensorsAsyncResp->asyncResp->res);
             return;
         }
@@ -1713,10 +1713,10 @@
             }
         }
         callback(inventoryItems);
-        BMCWEB_LOG_DEBUG << "getInventoryItemAssociations respHandler exit";
+        BMCWEB_LOG_DEBUG("getInventoryItemAssociations respHandler exit");
         });
 
-    BMCWEB_LOG_DEBUG << "getInventoryItemAssociations exit";
+    BMCWEB_LOG_DEBUG("getInventoryItemAssociations exit");
 }
 
 /**
@@ -1755,13 +1755,13 @@
     std::shared_ptr<std::map<std::string, std::string>> ledConnections,
     Callback&& callback, size_t ledConnectionsIndex = 0)
 {
-    BMCWEB_LOG_DEBUG << "getInventoryLedData enter";
+    BMCWEB_LOG_DEBUG("getInventoryLedData enter");
 
     // If no more connections left, call callback
     if (ledConnectionsIndex >= ledConnections->size())
     {
         callback();
-        BMCWEB_LOG_DEBUG << "getInventoryLedData exit";
+        BMCWEB_LOG_DEBUG("getInventoryLedData exit");
         return;
     }
 
@@ -1777,16 +1777,16 @@
             [sensorsAsyncResp, inventoryItems, ledConnections, ledPath,
              callback{std::forward<Callback>(callback)}, ledConnectionsIndex](
                 const boost::system::error_code& ec, const std::string& state) {
-            BMCWEB_LOG_DEBUG << "getInventoryLedData respHandler enter";
+            BMCWEB_LOG_DEBUG("getInventoryLedData respHandler enter");
             if (ec)
             {
-                BMCWEB_LOG_ERROR
-                    << "getInventoryLedData respHandler DBus error " << ec;
+                BMCWEB_LOG_ERROR(
+                    "getInventoryLedData respHandler DBus error {}", ec);
                 messages::internalError(sensorsAsyncResp->asyncResp->res);
                 return;
             }
 
-            BMCWEB_LOG_DEBUG << "Led state: " << state;
+            BMCWEB_LOG_DEBUG("Led state: {}", state);
             // Find inventory item with this LED object path
             InventoryItem* inventoryItem =
                 findInventoryItemForLed(*inventoryItems, ledPath);
@@ -1816,7 +1816,7 @@
                                 ledConnections, std::move(callback),
                                 ledConnectionsIndex + 1);
 
-            BMCWEB_LOG_DEBUG << "getInventoryLedData respHandler exit";
+            BMCWEB_LOG_DEBUG("getInventoryLedData respHandler exit");
         };
 
         // Get the State property for the current LED
@@ -1826,7 +1826,7 @@
             std::move(respHandler));
     }
 
-    BMCWEB_LOG_DEBUG << "getInventoryLedData exit";
+    BMCWEB_LOG_DEBUG("getInventoryLedData exit");
 }
 
 /**
@@ -1857,7 +1857,7 @@
     std::shared_ptr<std::vector<InventoryItem>> inventoryItems,
     Callback&& callback)
 {
-    BMCWEB_LOG_DEBUG << "getInventoryLeds enter";
+    BMCWEB_LOG_DEBUG("getInventoryLeds enter");
 
     const std::string path = "/xyz/openbmc_project";
     constexpr std::array<std::string_view, 1> interfaces = {
@@ -1871,12 +1871,11 @@
             const boost::system::error_code& ec,
             const dbus::utility::MapperGetSubTreeResponse& subtree) {
         // Response handler for parsing output from GetSubTree
-        BMCWEB_LOG_DEBUG << "getInventoryLeds respHandler enter";
+        BMCWEB_LOG_DEBUG("getInventoryLeds respHandler enter");
         if (ec)
         {
             messages::internalError(sensorsAsyncResp->asyncResp->res);
-            BMCWEB_LOG_ERROR << "getInventoryLeds respHandler DBus error "
-                             << ec;
+            BMCWEB_LOG_ERROR("getInventoryLeds respHandler DBus error {}", ec);
             return;
         }
 
@@ -1898,16 +1897,15 @@
                 // Add mapping from ledPath to connection
                 const std::string& connection = object.second.begin()->first;
                 (*ledConnections)[ledPath] = connection;
-                BMCWEB_LOG_DEBUG << "Added mapping " << ledPath << " -> "
-                                 << connection;
+                BMCWEB_LOG_DEBUG("Added mapping {} -> {}", ledPath, connection);
             }
         }
 
         getInventoryLedData(sensorsAsyncResp, inventoryItems, ledConnections,
                             std::move(callback));
-        BMCWEB_LOG_DEBUG << "getInventoryLeds respHandler exit";
+        BMCWEB_LOG_DEBUG("getInventoryLeds respHandler exit");
         });
-    BMCWEB_LOG_DEBUG << "getInventoryLeds exit";
+    BMCWEB_LOG_DEBUG("getInventoryLeds exit");
 }
 
 /**
@@ -1941,11 +1939,11 @@
     const std::map<std::string, std::string>& psAttributesConnections,
     Callback&& callback)
 {
-    BMCWEB_LOG_DEBUG << "getPowerSupplyAttributesData enter";
+    BMCWEB_LOG_DEBUG("getPowerSupplyAttributesData enter");
 
     if (psAttributesConnections.empty())
     {
-        BMCWEB_LOG_DEBUG << "Can't find PowerSupplyAttributes, no connections!";
+        BMCWEB_LOG_DEBUG("Can't find PowerSupplyAttributes, no connections!");
         callback(inventoryItems);
         return;
     }
@@ -1961,16 +1959,16 @@
         [sensorsAsyncResp, inventoryItems,
          callback{std::forward<Callback>(callback)}](
             const boost::system::error_code& ec, const uint32_t value) {
-        BMCWEB_LOG_DEBUG << "getPowerSupplyAttributesData respHandler enter";
+        BMCWEB_LOG_DEBUG("getPowerSupplyAttributesData respHandler enter");
         if (ec)
         {
-            BMCWEB_LOG_ERROR
-                << "getPowerSupplyAttributesData respHandler DBus error " << ec;
+            BMCWEB_LOG_ERROR(
+                "getPowerSupplyAttributesData respHandler DBus error {}", ec);
             messages::internalError(sensorsAsyncResp->asyncResp->res);
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "PS EfficiencyPercent value: " << value;
+        BMCWEB_LOG_DEBUG("PS EfficiencyPercent value: {}", value);
         // Store value in Power Supply Inventory Items
         for (InventoryItem& inventoryItem : *inventoryItems)
         {
@@ -1981,7 +1979,7 @@
             }
         }
 
-        BMCWEB_LOG_DEBUG << "getPowerSupplyAttributesData respHandler exit";
+        BMCWEB_LOG_DEBUG("getPowerSupplyAttributesData respHandler exit");
         callback(inventoryItems);
     };
 
@@ -1992,7 +1990,7 @@
         "xyz.openbmc_project.Control.PowerSupplyAttributes", "DeratingFactor",
         std::move(respHandler));
 
-    BMCWEB_LOG_DEBUG << "getPowerSupplyAttributesData exit";
+    BMCWEB_LOG_DEBUG("getPowerSupplyAttributesData exit");
 }
 
 /**
@@ -2024,12 +2022,12 @@
     std::shared_ptr<std::vector<InventoryItem>> inventoryItems,
     Callback&& callback)
 {
-    BMCWEB_LOG_DEBUG << "getPowerSupplyAttributes enter";
+    BMCWEB_LOG_DEBUG("getPowerSupplyAttributes enter");
 
     // Only need the power supply attributes when the Power Schema
     if (sensorsAsyncResp->chassisSubNode != sensors::node::power)
     {
-        BMCWEB_LOG_DEBUG << "getPowerSupplyAttributes exit since not Power";
+        BMCWEB_LOG_DEBUG("getPowerSupplyAttributes exit since not Power");
         callback(inventoryItems);
         return;
     }
@@ -2045,17 +2043,17 @@
             const boost::system::error_code& ec,
             const dbus::utility::MapperGetSubTreeResponse& subtree) {
         // Response handler for parsing output from GetSubTree
-        BMCWEB_LOG_DEBUG << "getPowerSupplyAttributes respHandler enter";
+        BMCWEB_LOG_DEBUG("getPowerSupplyAttributes respHandler enter");
         if (ec)
         {
             messages::internalError(sensorsAsyncResp->asyncResp->res);
-            BMCWEB_LOG_ERROR
-                << "getPowerSupplyAttributes respHandler DBus error " << ec;
+            BMCWEB_LOG_ERROR(
+                "getPowerSupplyAttributes respHandler DBus error {}", ec);
             return;
         }
         if (subtree.empty())
         {
-            BMCWEB_LOG_DEBUG << "Can't find Power Supply Attributes!";
+            BMCWEB_LOG_DEBUG("Can't find Power Supply Attributes!");
             callback(inventoryItems);
             return;
         }
@@ -2067,7 +2065,7 @@
 
         if (subtree[0].first.empty() || subtree[0].second.empty())
         {
-            BMCWEB_LOG_DEBUG << "Power Supply Attributes mapper error!";
+            BMCWEB_LOG_DEBUG("Power Supply Attributes mapper error!");
             callback(inventoryItems);
             return;
         }
@@ -2077,21 +2075,21 @@
 
         if (connection.empty())
         {
-            BMCWEB_LOG_DEBUG << "Power Supply Attributes mapper error!";
+            BMCWEB_LOG_DEBUG("Power Supply Attributes mapper error!");
             callback(inventoryItems);
             return;
         }
 
         psAttributesConnections[psAttributesPath] = connection;
-        BMCWEB_LOG_DEBUG << "Added mapping " << psAttributesPath << " -> "
-                         << connection;
+        BMCWEB_LOG_DEBUG("Added mapping {} -> {}", psAttributesPath,
+                         connection);
 
         getPowerSupplyAttributesData(sensorsAsyncResp, inventoryItems,
                                      psAttributesConnections,
                                      std::move(callback));
-        BMCWEB_LOG_DEBUG << "getPowerSupplyAttributes respHandler exit";
+        BMCWEB_LOG_DEBUG("getPowerSupplyAttributes respHandler exit");
         });
-    BMCWEB_LOG_DEBUG << "getPowerSupplyAttributes exit";
+    BMCWEB_LOG_DEBUG("getPowerSupplyAttributes exit");
 }
 
 /**
@@ -2122,52 +2120,52 @@
                       const std::shared_ptr<std::set<std::string>> sensorNames,
                       Callback&& callback)
 {
-    BMCWEB_LOG_DEBUG << "getInventoryItems enter";
+    BMCWEB_LOG_DEBUG("getInventoryItems enter");
     auto getInventoryItemAssociationsCb =
         [sensorsAsyncResp, callback{std::forward<Callback>(callback)}](
             std::shared_ptr<std::vector<InventoryItem>> inventoryItems) {
-        BMCWEB_LOG_DEBUG << "getInventoryItemAssociationsCb enter";
+        BMCWEB_LOG_DEBUG("getInventoryItemAssociationsCb enter");
         auto getInventoryItemsConnectionsCb =
             [sensorsAsyncResp, inventoryItems,
              callback{std::forward<const Callback>(callback)}](
                 std::shared_ptr<std::set<std::string>> invConnections) {
-            BMCWEB_LOG_DEBUG << "getInventoryItemsConnectionsCb enter";
+            BMCWEB_LOG_DEBUG("getInventoryItemsConnectionsCb enter");
             auto getInventoryItemsDataCb = [sensorsAsyncResp, inventoryItems,
                                             callback{std::move(callback)}]() {
-                BMCWEB_LOG_DEBUG << "getInventoryItemsDataCb enter";
+                BMCWEB_LOG_DEBUG("getInventoryItemsDataCb enter");
 
                 auto getInventoryLedsCb = [sensorsAsyncResp, inventoryItems,
                                            callback{std::move(callback)}]() {
-                    BMCWEB_LOG_DEBUG << "getInventoryLedsCb enter";
+                    BMCWEB_LOG_DEBUG("getInventoryLedsCb enter");
                     // Find Power Supply Attributes and get the data
                     getPowerSupplyAttributes(sensorsAsyncResp, inventoryItems,
                                              std::move(callback));
-                    BMCWEB_LOG_DEBUG << "getInventoryLedsCb exit";
+                    BMCWEB_LOG_DEBUG("getInventoryLedsCb exit");
                 };
 
                 // Find led connections and get the data
                 getInventoryLeds(sensorsAsyncResp, inventoryItems,
                                  std::move(getInventoryLedsCb));
-                BMCWEB_LOG_DEBUG << "getInventoryItemsDataCb exit";
+                BMCWEB_LOG_DEBUG("getInventoryItemsDataCb exit");
             };
 
             // Get inventory item data from connections
             getInventoryItemsData(sensorsAsyncResp, inventoryItems,
                                   invConnections,
                                   std::move(getInventoryItemsDataCb));
-            BMCWEB_LOG_DEBUG << "getInventoryItemsConnectionsCb exit";
+            BMCWEB_LOG_DEBUG("getInventoryItemsConnectionsCb exit");
         };
 
         // Get connections that provide inventory item data
         getInventoryItemsConnections(sensorsAsyncResp, inventoryItems,
                                      std::move(getInventoryItemsConnectionsCb));
-        BMCWEB_LOG_DEBUG << "getInventoryItemAssociationsCb exit";
+        BMCWEB_LOG_DEBUG("getInventoryItemAssociationsCb exit");
     };
 
     // Get associations from sensors to inventory items
     getInventoryItemAssociations(sensorsAsyncResp, sensorNames,
                                  std::move(getInventoryItemAssociationsCb));
-    BMCWEB_LOG_DEBUG << "getInventoryItems exit";
+    BMCWEB_LOG_DEBUG("getInventoryItems exit");
 }
 
 /**
@@ -2258,7 +2256,7 @@
     const std::set<std::string>& connections,
     const std::shared_ptr<std::vector<InventoryItem>>& inventoryItems)
 {
-    BMCWEB_LOG_DEBUG << "getSensorData enter";
+    BMCWEB_LOG_DEBUG("getSensorData enter");
     // Get managed objects from all services exposing sensors
     for (const std::string& connection : connections)
     {
@@ -2269,10 +2267,10 @@
             [sensorsAsyncResp, sensorNames,
              inventoryItems](const boost::system::error_code& ec,
                              const dbus::utility::ManagedObjectType& resp) {
-            BMCWEB_LOG_DEBUG << "getManagedObjectsCb enter";
+            BMCWEB_LOG_DEBUG("getManagedObjectsCb enter");
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "getManagedObjectsCb DBUS error: " << ec;
+                BMCWEB_LOG_ERROR("getManagedObjectsCb DBUS error: {}", ec);
                 messages::internalError(sensorsAsyncResp->asyncResp->res);
                 return;
             }
@@ -2281,8 +2279,8 @@
             {
                 const std::string& objPath =
                     static_cast<const std::string&>(objDictEntry.first);
-                BMCWEB_LOG_DEBUG << "getManagedObjectsCb parsing object "
-                                 << objPath;
+                BMCWEB_LOG_DEBUG("getManagedObjectsCb parsing object {}",
+                                 objPath);
 
                 std::vector<std::string> split;
                 // Reserve space for
@@ -2292,19 +2290,19 @@
                 bmcweb::split(split, objPath, '/');
                 if (split.size() < 6)
                 {
-                    BMCWEB_LOG_ERROR << "Got path that isn't long enough "
-                                     << objPath;
+                    BMCWEB_LOG_ERROR("Got path that isn't long enough {}",
+                                     objPath);
                     continue;
                 }
                 // These indexes aren't intuitive, as split puts an empty
                 // string at the beginning
                 const std::string& sensorType = split[4];
                 const std::string& sensorName = split[5];
-                BMCWEB_LOG_DEBUG << "sensorName " << sensorName
-                                 << " sensorType " << sensorType;
+                BMCWEB_LOG_DEBUG("sensorName {} sensorType {}", sensorName,
+                                 sensorType);
                 if (sensorNames->find(objPath) == sensorNames->end())
                 {
-                    BMCWEB_LOG_DEBUG << sensorName << " not in sensor list ";
+                    BMCWEB_LOG_DEBUG("{} not in sensor list ", sensorName);
                     continue;
                 }
 
@@ -2375,8 +2373,8 @@
                     }
                     else
                     {
-                        BMCWEB_LOG_ERROR << "Unsure how to handle sensorType "
-                                         << sensorType;
+                        BMCWEB_LOG_ERROR("Unsure how to handle sensorType {}",
+                                         sensorType);
                         continue;
                     }
 
@@ -2476,10 +2474,10 @@
                     populateFanRedundancy(sensorsAsyncResp);
                 }
             }
-            BMCWEB_LOG_DEBUG << "getManagedObjectsCb exit";
+            BMCWEB_LOG_DEBUG("getManagedObjectsCb exit");
             });
     }
-    BMCWEB_LOG_DEBUG << "getSensorData exit";
+    BMCWEB_LOG_DEBUG("getSensorData exit");
 }
 
 inline void
@@ -2488,23 +2486,23 @@
 {
     auto getConnectionCb = [sensorsAsyncResp, sensorNames](
                                const std::set<std::string>& connections) {
-        BMCWEB_LOG_DEBUG << "getConnectionCb enter";
+        BMCWEB_LOG_DEBUG("getConnectionCb enter");
         auto getInventoryItemsCb =
             [sensorsAsyncResp, sensorNames,
              connections](const std::shared_ptr<std::vector<InventoryItem>>&
                               inventoryItems) {
-            BMCWEB_LOG_DEBUG << "getInventoryItemsCb enter";
+            BMCWEB_LOG_DEBUG("getInventoryItemsCb enter");
             // Get sensor data and store results in JSON
             getSensorData(sensorsAsyncResp, sensorNames, connections,
                           inventoryItems);
-            BMCWEB_LOG_DEBUG << "getInventoryItemsCb exit";
+            BMCWEB_LOG_DEBUG("getInventoryItemsCb exit");
         };
 
         // Get inventory items associated with sensors
         getInventoryItems(sensorsAsyncResp, sensorNames,
                           std::move(getInventoryItemsCb));
 
-        BMCWEB_LOG_DEBUG << "getConnectionCb exit";
+        BMCWEB_LOG_DEBUG("getConnectionCb exit");
     };
 
     // Get set of connections that provide sensor values
@@ -2519,13 +2517,13 @@
 inline void
     getChassisData(const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp)
 {
-    BMCWEB_LOG_DEBUG << "getChassisData enter";
+    BMCWEB_LOG_DEBUG("getChassisData enter");
     auto getChassisCb =
         [sensorsAsyncResp](
             const std::shared_ptr<std::set<std::string>>& sensorNames) {
-        BMCWEB_LOG_DEBUG << "getChassisCb enter";
+        BMCWEB_LOG_DEBUG("getChassisCb enter");
         processSensorList(sensorsAsyncResp, sensorNames);
-        BMCWEB_LOG_DEBUG << "getChassisCb exit";
+        BMCWEB_LOG_DEBUG("getChassisCb exit");
     };
     // SensorCollection doesn't contain the Redundancy property
     if (sensorsAsyncResp->chassisSubNode != sensors::node::sensors)
@@ -2537,7 +2535,7 @@
     getChassis(sensorsAsyncResp->asyncResp, sensorsAsyncResp->chassisId,
                sensorsAsyncResp->chassisSubNode, sensorsAsyncResp->types,
                std::move(getChassisCb));
-    BMCWEB_LOG_DEBUG << "getChassisData exit";
+    BMCWEB_LOG_DEBUG("getChassisData exit");
 }
 
 /**
@@ -2601,8 +2599,8 @@
     std::unordered_map<std::string, std::vector<nlohmann::json>>&
         allCollections)
 {
-    BMCWEB_LOG_INFO << "setSensorsOverride for subNode"
-                    << sensorAsyncResp->chassisSubNode << "\n";
+    BMCWEB_LOG_INFO("setSensorsOverride for subNode{}",
+                    sensorAsyncResp->chassisSubNode);
 
     const char* propertyValueName = nullptr;
     std::unordered_map<std::string, std::pair<double, std::string>> overrideMap;
@@ -2650,7 +2648,7 @@
             if (!findSensorNameUsingSensorPath(sensorNameType.second,
                                                *sensorsList, *sensorNames))
             {
-                BMCWEB_LOG_INFO << "Unable to find memberId " << item.first;
+                BMCWEB_LOG_INFO("Unable to find memberId {}", item.first);
                 messages::resourceNotFound(sensorAsyncResp->asyncResp->res,
                                            item.second.second, item.first);
                 return;
@@ -2664,10 +2662,9 @@
                               objectsWithConnection) {
             if (objectsWithConnection.size() != overrideMap.size())
             {
-                BMCWEB_LOG_INFO
-                    << "Unable to find all objects with proper connection "
-                    << objectsWithConnection.size() << " requested "
-                    << overrideMap.size() << "\n";
+                BMCWEB_LOG_INFO(
+                    "Unable to find all objects with proper connection {} requested {}",
+                    objectsWithConnection.size(), overrideMap.size());
                 messages::resourceNotFound(sensorAsyncResp->asyncResp->res,
                                            sensorAsyncResp->chassisSubNode ==
                                                    sensors::node::thermal
@@ -2689,8 +2686,8 @@
                 const auto& iterator = overrideMap.find(sensorName);
                 if (iterator == overrideMap.end())
                 {
-                    BMCWEB_LOG_INFO << "Unable to find sensor object"
-                                    << item.first << "\n";
+                    BMCWEB_LOG_INFO("Unable to find sensor object{}",
+                                    item.first);
                     messages::internalError(sensorAsyncResp->asyncResp->res);
                     return;
                 }
@@ -2704,16 +2701,16 @@
                         if (ec.value() ==
                             boost::system::errc::permission_denied)
                         {
-                            BMCWEB_LOG_WARNING
-                                << "Manufacturing mode is not Enabled...can't "
-                                   "Override the sensor value. ";
+                            BMCWEB_LOG_WARNING(
+                                "Manufacturing mode is not Enabled...can't "
+                                "Override the sensor value. ");
 
                             messages::insufficientPrivilege(
                                 sensorAsyncResp->asyncResp->res);
                             return;
                         }
-                        BMCWEB_LOG_DEBUG
-                            << "setOverrideValueStatus DBUS error: " << ec;
+                        BMCWEB_LOG_DEBUG(
+                            "setOverrideValueStatus DBUS error: {}", ec);
                         messages::internalError(
                             sensorAsyncResp->asyncResp->res);
                     }
@@ -2751,7 +2748,7 @@
                      [&node](auto&& val) { return val.first == node; });
     if (pathIt == sensors::paths.cend())
     {
-        BMCWEB_LOG_ERROR << "Wrong node provided : " << node;
+        BMCWEB_LOG_ERROR("Wrong node provided : {}", node);
         mapComplete(boost::beast::http::status::bad_request, {});
         return;
     }
@@ -2776,18 +2773,18 @@
     std::string_view chassisId, std::string_view chassisSubNode,
     const std::shared_ptr<std::set<std::string>>& sensorNames)
 {
-    BMCWEB_LOG_DEBUG << "getChassisCallback enter ";
+    BMCWEB_LOG_DEBUG("getChassisCallback enter ");
 
     nlohmann::json& entriesArray = asyncResp->res.jsonValue["Members"];
     for (const std::string& sensor : *sensorNames)
     {
-        BMCWEB_LOG_DEBUG << "Adding sensor: " << sensor;
+        BMCWEB_LOG_DEBUG("Adding sensor: {}", sensor);
 
         sdbusplus::message::object_path path(sensor);
         std::string sensorName = path.filename();
         if (sensorName.empty())
         {
-            BMCWEB_LOG_ERROR << "Invalid sensor path: " << sensor;
+            BMCWEB_LOG_ERROR("Invalid sensor path: {}", sensor);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -2807,7 +2804,7 @@
     }
 
     asyncResp->res.jsonValue["Members@odata.count"] = entriesArray.size();
-    BMCWEB_LOG_DEBUG << "getChassisCallback exit";
+    BMCWEB_LOG_DEBUG("getChassisCallback exit");
 }
 
 inline void handleSensorCollectionGet(
@@ -2834,8 +2831,8 @@
             /*efficientExpand=*/true);
         getChassisData(sensorsAsyncResp);
 
-        BMCWEB_LOG_DEBUG
-            << "SensorCollection doGet exit via efficient expand handler";
+        BMCWEB_LOG_DEBUG(
+            "SensorCollection doGet exit via efficient expand handler");
         return;
     }
 
@@ -2858,8 +2855,8 @@
     }
     const auto& valueIface = *mapperResponse.begin();
     const std::string& connectionName = valueIface.first;
-    BMCWEB_LOG_DEBUG << "Looking up " << connectionName;
-    BMCWEB_LOG_DEBUG << "Path " << sensorPath;
+    BMCWEB_LOG_DEBUG("Looking up {}", connectionName);
+    BMCWEB_LOG_DEBUG("Path {}", sensorPath);
 
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, connectionName, sensorPath, "",
@@ -2900,7 +2897,7 @@
     asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
         "/redfish/v1/Chassis/{}/Sensors/{}", chassisId, sensorId);
 
-    BMCWEB_LOG_DEBUG << "Sensor doGet enter";
+    BMCWEB_LOG_DEBUG("Sensor doGet enter");
 
     constexpr std::array<std::string_view, 1> interfaces = {
         "xyz.openbmc_project.Sensor.Value"};
@@ -2913,22 +2910,22 @@
         [asyncResp, sensorId,
          sensorPath](const boost::system::error_code& ec,
                      const ::dbus::utility::MapperGetObject& subtree) {
-        BMCWEB_LOG_DEBUG << "respHandler1 enter";
+        BMCWEB_LOG_DEBUG("respHandler1 enter");
         if (ec == boost::system::errc::io_error)
         {
-            BMCWEB_LOG_WARNING << "Sensor not found from getSensorPaths";
+            BMCWEB_LOG_WARNING("Sensor not found from getSensorPaths");
             messages::resourceNotFound(asyncResp->res, sensorId, "Sensor");
             return;
         }
         if (ec)
         {
             messages::internalError(asyncResp->res);
-            BMCWEB_LOG_ERROR << "Sensor getSensorPaths resp_handler: "
-                             << "Dbus error " << ec;
+            BMCWEB_LOG_ERROR(
+                "Sensor getSensorPaths resp_handler: Dbus error {}", ec);
             return;
         }
         getSensorFromDbus(asyncResp, sensorPath, subtree);
-        BMCWEB_LOG_DEBUG << "respHandler1 exit";
+        BMCWEB_LOG_DEBUG("respHandler1 exit");
         });
 }
 
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
index 6b60ae7..1f41ea8 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -110,7 +110,7 @@
 {
     if (ec)
     {
-        BMCWEB_LOG_ERROR << "Drive mapper call error";
+        BMCWEB_LOG_ERROR("Drive mapper call error");
         messages::internalError(asyncResp->res);
         return;
     }
@@ -131,7 +131,7 @@
         sdbusplus::message::object_path object(drive);
         if (object.filename().empty())
         {
-            BMCWEB_LOG_ERROR << "Failed to find filename in " << drive;
+            BMCWEB_LOG_ERROR("Failed to find filename in {}", drive);
             return;
         }
 
@@ -161,7 +161,7 @@
 {
     if (ec)
     {
-        BMCWEB_LOG_DEBUG << "requestRoutesStorage DBUS response error";
+        BMCWEB_LOG_DEBUG("requestRoutesStorage DBUS response error");
         messages::resourceNotFound(asyncResp->res, "#Storage.v1_13_0.Storage",
                                    storageId);
         return;
@@ -230,7 +230,7 @@
 {
     if (ec)
     {
-        BMCWEB_LOG_DEBUG << "requestRoutesStorage DBUS response error";
+        BMCWEB_LOG_DEBUG("requestRoutesStorage DBUS response error");
         messages::resourceNotFound(asyncResp->res, "#Storage.v1_13_0.Storage",
                                    storageId);
         return;
@@ -274,7 +274,7 @@
 {
     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
     {
-        BMCWEB_LOG_DEBUG << "requestRoutesStorage setUpRedfishRoute failed";
+        BMCWEB_LOG_DEBUG("requestRoutesStorage setUpRedfishRoute failed");
         return;
     }
 
@@ -478,7 +478,7 @@
                 if (value == nullptr)
                 {
                     // illegal property
-                    BMCWEB_LOG_ERROR << "Illegal property: Type";
+                    BMCWEB_LOG_ERROR("Illegal property: Type");
                     messages::internalError(asyncResp->res);
                     return;
                 }
@@ -487,8 +487,8 @@
                     convertDriveType(*value);
                 if (!mediaType)
                 {
-                    BMCWEB_LOG_WARNING << "UnknownDriveType Interface: "
-                                       << *value;
+                    BMCWEB_LOG_WARNING("UnknownDriveType Interface: {}",
+                                       *value);
                     continue;
                 }
                 if (*mediaType == drive::MediaType::Invalid)
@@ -505,7 +505,7 @@
                     std::get_if<uint64_t>(&property.second);
                 if (capacity == nullptr)
                 {
-                    BMCWEB_LOG_ERROR << "Illegal property: Capacity";
+                    BMCWEB_LOG_ERROR("Illegal property: Capacity");
                     messages::internalError(asyncResp->res);
                     return;
                 }
@@ -523,7 +523,7 @@
                     std::get_if<std::string>(&property.second);
                 if (value == nullptr)
                 {
-                    BMCWEB_LOG_ERROR << "Illegal property: Protocol";
+                    BMCWEB_LOG_ERROR("Illegal property: Protocol");
                     messages::internalError(asyncResp->res);
                     return;
                 }
@@ -532,8 +532,8 @@
                     convertDriveProtocol(*value);
                 if (!proto)
                 {
-                    BMCWEB_LOG_WARNING << "Unknown DrivePrototype Interface: "
-                                       << *value;
+                    BMCWEB_LOG_WARNING("Unknown DrivePrototype Interface: {}",
+                                       *value);
                     continue;
                 }
                 if (*proto == protocol::Protocol::Invalid)
@@ -549,8 +549,8 @@
                     std::get_if<uint8_t>(&property.second);
                 if (lifeLeft == nullptr)
                 {
-                    BMCWEB_LOG_ERROR
-                        << "Illegal property: PredictedMediaLifeLeftPercent";
+                    BMCWEB_LOG_ERROR(
+                        "Illegal property: PredictedMediaLifeLeftPercent");
                     messages::internalError(asyncResp->res);
                     return;
                 }
@@ -566,7 +566,7 @@
                 encryptionStatus = std::get_if<std::string>(&property.second);
                 if (encryptionStatus == nullptr)
                 {
-                    BMCWEB_LOG_ERROR << "Illegal property: EncryptionStatus";
+                    BMCWEB_LOG_ERROR("Illegal property: EncryptionStatus");
                     messages::internalError(asyncResp->res);
                     return;
                 }
@@ -576,7 +576,7 @@
                 isLocked = std::get_if<bool>(&property.second);
                 if (isLocked == nullptr)
                 {
-                    BMCWEB_LOG_ERROR << "Illegal property: Locked";
+                    BMCWEB_LOG_ERROR("Illegal property: Locked");
                     messages::internalError(asyncResp->res);
                     return;
                 }
@@ -646,7 +646,7 @@
 {
     if (ec)
     {
-        BMCWEB_LOG_ERROR << "Drive mapper call error";
+        BMCWEB_LOG_ERROR("Drive mapper call error");
         messages::internalError(asyncResp->res);
         return;
     }
@@ -676,8 +676,8 @@
 
     if (connectionNames.size() != 1)
     {
-        BMCWEB_LOG_ERROR << "Connection size " << connectionNames.size()
-                         << ", not equal to 1";
+        BMCWEB_LOG_ERROR("Connection size {}, not equal to 1",
+                         connectionNames.size());
         messages::internalError(asyncResp->res);
         return;
     }
@@ -770,7 +770,7 @@
 
         if (connectionNames.empty())
         {
-            BMCWEB_LOG_ERROR << "Got 0 Connection names";
+            BMCWEB_LOG_ERROR("Got 0 Connection names");
             continue;
         }
 
@@ -787,7 +787,7 @@
                                    const dbus::utility::MapperEndPoints& resp) {
             if (ec3)
             {
-                BMCWEB_LOG_ERROR << "Error in chassis Drive association ";
+                BMCWEB_LOG_ERROR("Error in chassis Drive association ");
             }
             nlohmann::json& members = asyncResp->res.jsonValue["Members"];
             // important if array is empty
@@ -856,7 +856,7 @@
 {
     if (ec)
     {
-        BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+        BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
         messages::internalError(asyncResp->res);
         return;
     }
@@ -872,7 +872,7 @@
 
         if (connectionNames.empty())
         {
-            BMCWEB_LOG_ERROR << "Got 0 Connection names";
+            BMCWEB_LOG_ERROR("Got 0 Connection names");
             continue;
         }
 
@@ -959,7 +959,7 @@
 
             if (connectionNames.empty())
             {
-                BMCWEB_LOG_ERROR << "Got 0 Connection names";
+                BMCWEB_LOG_ERROR("Got 0 Connection names");
                 continue;
             }
 
@@ -999,7 +999,7 @@
     if (ec)
     {
         // this interface isn't necessary
-        BMCWEB_LOG_DEBUG << "Failed to get StorageControllerAsset";
+        BMCWEB_LOG_DEBUG("Failed to get StorageControllerAsset");
         return;
     }
 
@@ -1058,7 +1058,7 @@
         // if we get a good return
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "Failed to get Present property";
+            BMCWEB_LOG_DEBUG("Failed to get Present property");
             return;
         }
         if (!isPresent)
@@ -1086,7 +1086,7 @@
     if (ec || subtree.empty())
     {
         // doesn't have to be there
-        BMCWEB_LOG_DEBUG << "Failed to handle StorageController";
+        BMCWEB_LOG_DEBUG("Failed to handle StorageController");
         return;
     }
 
@@ -1096,7 +1096,7 @@
         std::string id = object.filename();
         if (id.empty())
         {
-            BMCWEB_LOG_ERROR << "Failed to find filename in " << path;
+            BMCWEB_LOG_ERROR("Failed to find filename in {}", path);
             return;
         }
         if (id != controllerId)
@@ -1106,8 +1106,8 @@
 
         if (interfaceDict.size() != 1)
         {
-            BMCWEB_LOG_ERROR << "Connection size " << interfaceDict.size()
-                             << ", greater than 1";
+            BMCWEB_LOG_ERROR("Connection size {}, greater than 1",
+                             interfaceDict.size());
             messages::internalError(asyncResp->res);
             return;
         }
@@ -1128,7 +1128,7 @@
     {
         asyncResp->res.jsonValue["Members"] = std::move(members);
         asyncResp->res.jsonValue["Members@odata.count"] = 0;
-        BMCWEB_LOG_DEBUG << "Failed to find any StorageController";
+        BMCWEB_LOG_DEBUG("Failed to find any StorageController");
         return;
     }
 
@@ -1137,7 +1137,7 @@
         std::string id = sdbusplus::message::object_path(path).filename();
         if (id.empty())
         {
-            BMCWEB_LOG_ERROR << "Failed to find filename in " << path;
+            BMCWEB_LOG_ERROR("Failed to find filename in {}", path);
             return;
         }
         nlohmann::json::object_t member;
@@ -1156,15 +1156,15 @@
 {
     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
     {
-        BMCWEB_LOG_DEBUG
-            << "Failed to setup Redfish Route for StorageController Collection";
+        BMCWEB_LOG_DEBUG(
+            "Failed to setup Redfish Route for StorageController Collection");
         return;
     }
     if (systemName != "system")
     {
         messages::resourceNotFound(asyncResp->res, "ComputerSystem",
                                    systemName);
-        BMCWEB_LOG_DEBUG << "Failed to find ComputerSystem of " << systemName;
+        BMCWEB_LOG_DEBUG("Failed to find ComputerSystem of {}", systemName);
         return;
     }
 
@@ -1192,15 +1192,14 @@
 {
     if (!redfish::setUpRedfishRoute(app, req, asyncResp))
     {
-        BMCWEB_LOG_DEBUG
-            << "Failed to setup Redfish Route for StorageController";
+        BMCWEB_LOG_DEBUG("Failed to setup Redfish Route for StorageController");
         return;
     }
     if (systemName != "system")
     {
         messages::resourceNotFound(asyncResp->res, "ComputerSystem",
                                    systemName);
-        BMCWEB_LOG_DEBUG << "Failed to find ComputerSystem of " << systemName;
+        BMCWEB_LOG_DEBUG("Failed to find ComputerSystem of {}", systemName);
         return;
     }
     constexpr std::array<std::string_view, 1> interfaces = {
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 69ef490..609af71 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -64,7 +64,7 @@
     updateDimmProperties(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                          bool isDimmFunctional)
 {
-    BMCWEB_LOG_DEBUG << "Dimm Functional: " << isDimmFunctional;
+    BMCWEB_LOG_DEBUG("Dimm Functional: {}", isDimmFunctional);
 
     // Set it as Enabled if at least one DIMM is functional
     // Update STATE only if previous State was DISABLED and current Dimm is
@@ -93,7 +93,7 @@
 inline void modifyCpuFunctionalState(
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, bool isCpuFunctional)
 {
-    BMCWEB_LOG_DEBUG << "Cpu Functional: " << isCpuFunctional;
+    BMCWEB_LOG_DEBUG("Cpu Functional: {}", isCpuFunctional);
 
     const nlohmann::json& prevProcState =
         asyncResp->res.jsonValue["ProcessorSummary"]["Status"]["State"];
@@ -123,7 +123,7 @@
     modifyCpuPresenceState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                            bool isCpuPresent)
 {
-    BMCWEB_LOG_DEBUG << "Cpu Present: " << isCpuPresent;
+    BMCWEB_LOG_DEBUG("Cpu Present: {}", isCpuPresent);
 
     if (isCpuPresent)
     {
@@ -144,7 +144,7 @@
     const std::vector<std::pair<std::string, dbus::utility::DbusVariantType>>&
         properties)
 {
-    BMCWEB_LOG_DEBUG << "Got " << properties.size() << " Cpu properties.";
+    BMCWEB_LOG_DEBUG("Got {} Cpu properties.", properties.size());
 
     // TODO: Get Model
 
@@ -193,7 +193,7 @@
                                            const bool cpuPresenceCheck) {
         if (ec3)
         {
-            BMCWEB_LOG_ERROR << "DBUS response error " << ec3;
+            BMCWEB_LOG_ERROR("DBUS response error {}", ec3);
             return;
         }
         modifyCpuPresenceState(asyncResp, cpuPresenceCheck);
@@ -212,7 +212,7 @@
                         const bool cpuFunctionalCheck) {
             if (ec3)
             {
-                BMCWEB_LOG_ERROR << "DBUS response error " << ec3;
+                BMCWEB_LOG_ERROR("DBUS response error {}", ec3);
                 return;
             }
             modifyCpuFunctionalState(asyncResp, cpuFunctionalCheck);
@@ -233,7 +233,7 @@
                const dbus::utility::DBusPropertiesMap& properties) {
         if (ec2)
         {
-            BMCWEB_LOG_ERROR << "DBUS response error " << ec2;
+            BMCWEB_LOG_ERROR("DBUS response error {}", ec2);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -257,7 +257,7 @@
                             [[maybe_unused]] const std::string& path,
                             const dbus::utility::DBusPropertiesMap& properties)
 {
-    BMCWEB_LOG_DEBUG << "Got " << properties.size() << " Dimm properties.";
+    BMCWEB_LOG_DEBUG("Got {} Dimm properties.", properties.size());
 
     if (properties.empty())
     {
@@ -272,7 +272,7 @@
                             bool dimmState) {
                 if (ec3)
                 {
-                    BMCWEB_LOG_ERROR << "DBUS response error " << ec3;
+                    BMCWEB_LOG_ERROR("DBUS response error {}", ec3);
                     return;
                 }
                 updateDimmProperties(asyncResp, dimmState);
@@ -338,7 +338,7 @@
                const dbus::utility::DBusPropertiesMap& properties) {
         if (ec2)
         {
-            BMCWEB_LOG_ERROR << "DBUS response error " << ec2;
+            BMCWEB_LOG_ERROR("DBUS response error {}", ec2);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -358,7 +358,7 @@
     getComputerSystem(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                       const std::shared_ptr<HealthPopulate>& systemHealth)
 {
-    BMCWEB_LOG_DEBUG << "Get available system components.";
+    BMCWEB_LOG_DEBUG("Get available system components.");
     constexpr std::array<std::string_view, 5> interfaces = {
         "xyz.openbmc_project.Inventory.Decorator.Asset",
         "xyz.openbmc_project.Inventory.Item.Cpu",
@@ -373,7 +373,7 @@
                        const dbus::utility::MapperGetSubTreeResponse& subtree) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error";
+            BMCWEB_LOG_DEBUG("DBUS response error");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -384,7 +384,7 @@
                  object : subtree)
         {
             const std::string& path = object.first;
-            BMCWEB_LOG_DEBUG << "Got path: " << path;
+            BMCWEB_LOG_DEBUG("Got path: {}", path);
             const std::vector<std::pair<std::string, std::vector<std::string>>>&
                 connectionNames = object.second;
             if (connectionNames.empty())
@@ -419,8 +419,7 @@
                     if (interfaceName ==
                         "xyz.openbmc_project.Inventory.Item.Dimm")
                     {
-                        BMCWEB_LOG_DEBUG
-                            << "Found Dimm, now get its properties.";
+                        BMCWEB_LOG_DEBUG("Found Dimm, now get its properties.");
 
                         getMemorySummary(asyncResp, connection.first, path);
 
@@ -432,8 +431,7 @@
                     else if (interfaceName ==
                              "xyz.openbmc_project.Inventory.Item.Cpu")
                     {
-                        BMCWEB_LOG_DEBUG
-                            << "Found Cpu, now get its properties.";
+                        BMCWEB_LOG_DEBUG("Found Cpu, now get its properties.");
 
                         getProcessorSummary(asyncResp, connection.first, path);
 
@@ -444,8 +442,7 @@
                     }
                     else if (interfaceName == "xyz.openbmc_project.Common.UUID")
                     {
-                        BMCWEB_LOG_DEBUG
-                            << "Found UUID, now get its properties.";
+                        BMCWEB_LOG_DEBUG("Found UUID, now get its properties.");
 
                         sdbusplus::asio::getAllProperties(
                             *crow::connections::systemBus, connection.first,
@@ -455,13 +452,12 @@
                                             properties) {
                             if (ec3)
                             {
-                                BMCWEB_LOG_DEBUG << "DBUS response error "
-                                                 << ec3;
+                                BMCWEB_LOG_DEBUG("DBUS response error {}", ec3);
                                 messages::internalError(asyncResp->res);
                                 return;
                             }
-                            BMCWEB_LOG_DEBUG << "Got " << properties.size()
-                                             << " UUID properties.";
+                            BMCWEB_LOG_DEBUG("Got {} UUID properties.",
+                                             properties.size());
 
                             const std::string* uUID = nullptr;
 
@@ -486,7 +482,7 @@
                                     valueStr.insert(18, 1, '-');
                                     valueStr.insert(23, 1, '-');
                                 }
-                                BMCWEB_LOG_DEBUG << "UUID = " << valueStr;
+                                BMCWEB_LOG_DEBUG("UUID = {}", valueStr);
                                 asyncResp->res.jsonValue["UUID"] = valueStr;
                             }
                             });
@@ -507,8 +503,8 @@
                                 // interface
                                 return;
                             }
-                            BMCWEB_LOG_DEBUG << "Got " << propertiesList.size()
-                                             << " properties for system";
+                            BMCWEB_LOG_DEBUG("Got {} properties for system",
+                                             propertiesList.size());
 
                             const std::string* partNumber = nullptr;
                             const std::string* serialNumber = nullptr;
@@ -598,7 +594,7 @@
  */
 inline void getHostState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
-    BMCWEB_LOG_DEBUG << "Get host information.";
+    BMCWEB_LOG_DEBUG("Get host information.");
     sdbusplus::asio::getProperty<std::string>(
         *crow::connections::systemBus, "xyz.openbmc_project.State.Host",
         "/xyz/openbmc_project/state/host0", "xyz.openbmc_project.State.Host",
@@ -611,15 +607,15 @@
             {
                 // Service not available, no error, just don't return
                 // host state info
-                BMCWEB_LOG_DEBUG << "Service not available " << ec;
+                BMCWEB_LOG_DEBUG("Service not available {}", ec);
                 return;
             }
-            BMCWEB_LOG_ERROR << "DBUS response error " << ec;
+            BMCWEB_LOG_ERROR("DBUS response error {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "Host state: " << hostState;
+        BMCWEB_LOG_DEBUG("Host state: {}", hostState);
         // Verify Host State
         if (hostState == "xyz.openbmc_project.State.Host.HostState.Running")
         {
@@ -814,8 +810,7 @@
     }
     else
     {
-        BMCWEB_LOG_DEBUG << "Unsupported D-Bus BootProgress "
-                         << dbusBootProgress;
+        BMCWEB_LOG_DEBUG("Unsupported D-Bus BootProgress {}", dbusBootProgress);
         // Just return the default
     }
     return rfBpLastState;
@@ -870,9 +865,9 @@
     }
     else
     {
-        BMCWEB_LOG_DEBUG
-            << "Invalid property value for BootSourceOverrideTarget: "
-            << bootSource;
+        BMCWEB_LOG_DEBUG(
+            "Invalid property value for BootSourceOverrideTarget: {}",
+            bootSource);
         messages::propertyValueNotInList(asyncResp->res, rfSource,
                                          "BootSourceTargetOverride");
         return -1;
@@ -902,7 +897,7 @@
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "Boot Progress: " << bootProgressStr;
+        BMCWEB_LOG_DEBUG("Boot Progress: {}", bootProgressStr);
 
         asyncResp->res.jsonValue["BootProgress"]["LastState"] =
             dbusToRfBootProgress(bootProgressStr);
@@ -927,7 +922,7 @@
                     const uint64_t lastStateTime) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "D-BUS response error " << ec;
+            BMCWEB_LOG_DEBUG("D-BUS response error {}", ec);
             return;
         }
 
@@ -966,7 +961,7 @@
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "Boot type: " << bootType;
+        BMCWEB_LOG_DEBUG("Boot type: {}", bootType);
 
         asyncResp->res
             .jsonValue["Boot"]
@@ -1003,12 +998,12 @@
                     const std::string& bootModeStr) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+            BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "Boot mode: " << bootModeStr;
+        BMCWEB_LOG_DEBUG("Boot mode: {}", bootModeStr);
 
         asyncResp->res
             .jsonValue["Boot"]
@@ -1047,7 +1042,7 @@
                     const std::string& bootSourceStr) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+            BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
             if (ec.value() == boost::asio::error::host_unreachable)
             {
                 return;
@@ -1056,7 +1051,7 @@
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "Boot source: " << bootSourceStr;
+        BMCWEB_LOG_DEBUG("Boot source: {}", bootSourceStr);
 
         auto rfSource = dbusToRfBootSource(bootSourceStr);
         if (!rfSource.empty())
@@ -1101,7 +1096,7 @@
         [asyncResp](const boost::system::error_code& ec, bool oneTimeSetting) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+            BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -1138,7 +1133,7 @@
                     const bool bootOverrideEnable) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+            BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
             if (ec.value() == boost::asio::error::host_unreachable)
             {
                 return;
@@ -1161,7 +1156,7 @@
 inline void
     getBootProperties(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
-    BMCWEB_LOG_DEBUG << "Get boot information.";
+    BMCWEB_LOG_DEBUG("Get boot information.");
 
     getBootOverrideSource(asyncResp);
     getBootOverrideType(asyncResp);
@@ -1183,7 +1178,7 @@
 inline void
     getLastResetTime(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
-    BMCWEB_LOG_DEBUG << "Getting System Last Reset Time";
+    BMCWEB_LOG_DEBUG("Getting System Last Reset Time");
 
     sdbusplus::asio::getProperty<uint64_t>(
         *crow::connections::systemBus, "xyz.openbmc_project.State.Chassis",
@@ -1193,7 +1188,7 @@
                     uint64_t lastResetTime) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "D-BUS response error " << ec;
+            BMCWEB_LOG_DEBUG("D-BUS response error {}", ec);
             return;
         }
 
@@ -1222,7 +1217,7 @@
 inline void getAutomaticRebootAttempts(
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
-    BMCWEB_LOG_DEBUG << "Get Automatic Retry policy";
+    BMCWEB_LOG_DEBUG("Get Automatic Retry policy");
 
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, "xyz.openbmc_project.State.Host",
@@ -1235,7 +1230,7 @@
         {
             if (ec.value() != EBADR)
             {
-                BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+                BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
                 messages::internalError(asyncResp->res);
             }
             return;
@@ -1279,7 +1274,7 @@
 inline void
     getAutomaticRetryPolicy(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
-    BMCWEB_LOG_DEBUG << "Get Automatic Retry policy";
+    BMCWEB_LOG_DEBUG("Get Automatic Retry policy");
 
     sdbusplus::asio::getProperty<bool>(
         *crow::connections::systemBus, "xyz.openbmc_project.Settings",
@@ -1291,13 +1286,13 @@
         {
             if (ec.value() != EBADR)
             {
-                BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+                BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
                 messages::internalError(asyncResp->res);
             }
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "Auto Reboot: " << autoRebootEnabled;
+        BMCWEB_LOG_DEBUG("Auto Reboot: {}", autoRebootEnabled);
         if (autoRebootEnabled)
         {
             asyncResp->res.jsonValue["Boot"]["AutomaticRetryConfig"] =
@@ -1332,7 +1327,7 @@
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
     const uint32_t retryAttempts)
 {
-    BMCWEB_LOG_DEBUG << "Set Automatic Retry Attempts.";
+    BMCWEB_LOG_DEBUG("Set Automatic Retry Attempts.");
     sdbusplus::asio::setProperty(
         *crow::connections::systemBus, "xyz.openbmc_project.State.Host",
         "/xyz/openbmc_project/state/host0",
@@ -1340,9 +1335,8 @@
         retryAttempts, [asyncResp](const boost::system::error_code& ec) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR
-                    << "DBUS response error: Set setAutomaticRetryAttempts"
-                    << ec;
+                BMCWEB_LOG_ERROR(
+                    "DBUS response error: Set setAutomaticRetryAttempts{}", ec);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -1383,7 +1377,7 @@
 inline void
     getPowerRestorePolicy(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
-    BMCWEB_LOG_DEBUG << "Get power restore policy";
+    BMCWEB_LOG_DEBUG("Get power restore policy");
 
     sdbusplus::asio::getProperty<std::string>(
         *crow::connections::systemBus, "xyz.openbmc_project.Settings",
@@ -1393,7 +1387,7 @@
                     const std::string& policy) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+            BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
             return;
         }
         computer_system::PowerRestorePolicyTypes restore =
@@ -1418,7 +1412,7 @@
 inline void
     getStopBootOnFault(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
-    BMCWEB_LOG_DEBUG << "Get Stop Boot On Fault";
+    BMCWEB_LOG_DEBUG("Get Stop Boot On Fault");
 
     sdbusplus::asio::getProperty<bool>(
         *crow::connections::systemBus, "xyz.openbmc_project.Settings",
@@ -1456,7 +1450,7 @@
 inline void getTrustedModuleRequiredToBoot(
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
-    BMCWEB_LOG_DEBUG << "Get TPM required to boot.";
+    BMCWEB_LOG_DEBUG("Get TPM required to boot.");
     constexpr std::array<std::string_view, 1> interfaces = {
         "xyz.openbmc_project.Control.TPM.Policy"};
     dbus::utility::getSubTree(
@@ -1465,8 +1459,8 @@
                     const dbus::utility::MapperGetSubTreeResponse& subtree) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error on TPM.Policy GetSubTree"
-                             << ec;
+            BMCWEB_LOG_DEBUG("DBUS response error on TPM.Policy GetSubTree{}",
+                             ec);
             // This is an optional D-Bus object so just return if
             // error occurs
             return;
@@ -1481,9 +1475,9 @@
         /* When there is more than one TPMEnable object... */
         if (subtree.size() > 1)
         {
-            BMCWEB_LOG_DEBUG
-                << "DBUS response has more than 1 TPM Enable object:"
-                << subtree.size();
+            BMCWEB_LOG_DEBUG(
+                "DBUS response has more than 1 TPM Enable object:{}",
+                subtree.size());
             // Throw an internal Error and return
             messages::internalError(asyncResp->res);
             return;
@@ -1493,7 +1487,7 @@
         // field
         if (subtree[0].first.empty() || subtree[0].second.size() != 1)
         {
-            BMCWEB_LOG_DEBUG << "TPM.Policy mapper error!";
+            BMCWEB_LOG_DEBUG("TPM.Policy mapper error!");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -1509,8 +1503,8 @@
                         bool tpmRequired) {
             if (ec2)
             {
-                BMCWEB_LOG_DEBUG << "D-BUS response error on TPM.Policy Get"
-                                 << ec2;
+                BMCWEB_LOG_DEBUG("D-BUS response error on TPM.Policy Get{}",
+                                 ec2);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -1543,7 +1537,7 @@
 inline void setTrustedModuleRequiredToBoot(
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const bool tpmRequired)
 {
-    BMCWEB_LOG_DEBUG << "Set TrustedModuleRequiredToBoot.";
+    BMCWEB_LOG_DEBUG("Set TrustedModuleRequiredToBoot.");
     constexpr std::array<std::string_view, 1> interfaces = {
         "xyz.openbmc_project.Control.TPM.Policy"};
     dbus::utility::getSubTree(
@@ -1553,8 +1547,8 @@
                       const dbus::utility::MapperGetSubTreeResponse& subtree) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error on TPM.Policy GetSubTree"
-                             << ec;
+            BMCWEB_LOG_DEBUG("DBUS response error on TPM.Policy GetSubTree{}",
+                             ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -1568,9 +1562,9 @@
         /* When there is more than one TPMEnable object... */
         if (subtree.size() > 1)
         {
-            BMCWEB_LOG_DEBUG
-                << "DBUS response has more than 1 TPM Enable object:"
-                << subtree.size();
+            BMCWEB_LOG_DEBUG(
+                "DBUS response has more than 1 TPM Enable object:{}",
+                subtree.size());
             // Throw an internal Error and return
             messages::internalError(asyncResp->res);
             return;
@@ -1580,7 +1574,7 @@
         // field
         if (subtree[0].first.empty() || subtree[0].second.size() != 1)
         {
-            BMCWEB_LOG_DEBUG << "TPM.Policy mapper error!";
+            BMCWEB_LOG_DEBUG("TPM.Policy mapper error!");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -1590,7 +1584,7 @@
 
         if (serv.empty())
         {
-            BMCWEB_LOG_DEBUG << "TPM.Policy service mapper error!";
+            BMCWEB_LOG_DEBUG("TPM.Policy service mapper error!");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -1602,13 +1596,13 @@
             [asyncResp](const boost::system::error_code& ec2) {
             if (ec2)
             {
-                BMCWEB_LOG_DEBUG
-                    << "DBUS response error: Set TrustedModuleRequiredToBoot"
-                    << ec2;
+                BMCWEB_LOG_DEBUG(
+                    "DBUS response error: Set TrustedModuleRequiredToBoot{}",
+                    ec2);
                 messages::internalError(asyncResp->res);
                 return;
             }
-            BMCWEB_LOG_DEBUG << "Set TrustedModuleRequiredToBoot done.";
+            BMCWEB_LOG_DEBUG("Set TrustedModuleRequiredToBoot done.");
             });
         });
 }
@@ -1631,7 +1625,7 @@
     }
 
     // Source target specified
-    BMCWEB_LOG_DEBUG << "Boot type: " << *bootType;
+    BMCWEB_LOG_DEBUG("Boot type: {}", *bootType);
     // Figure out which DBUS interface and property to use
     if (*bootType == "Legacy")
     {
@@ -1643,16 +1637,16 @@
     }
     else
     {
-        BMCWEB_LOG_DEBUG << "Invalid property value for "
-                            "BootSourceOverrideMode: "
-                         << *bootType;
+        BMCWEB_LOG_DEBUG("Invalid property value for "
+                         "BootSourceOverrideMode: {}",
+                         *bootType);
         messages::propertyValueNotInList(asyncResp->res, *bootType,
                                          "BootSourceOverrideMode");
         return;
     }
 
     // Act on validated parameters
-    BMCWEB_LOG_DEBUG << "DBUS boot type: " << bootTypeStr;
+    BMCWEB_LOG_DEBUG("DBUS boot type: {}", bootTypeStr);
 
     sdbusplus::asio::setProperty(
         *crow::connections::systemBus, "xyz.openbmc_project.Settings",
@@ -1661,7 +1655,7 @@
         [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+            BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
             if (ec.value() == boost::asio::error::host_unreachable)
             {
                 messages::resourceNotFound(asyncResp->res, "Set", "BootType");
@@ -1670,7 +1664,7 @@
             messages::internalError(asyncResp->res);
             return;
         }
-        BMCWEB_LOG_DEBUG << "Boot type update done.";
+        BMCWEB_LOG_DEBUG("Boot type update done.");
         });
 }
 
@@ -1690,7 +1684,7 @@
         return;
     }
     // Source target specified
-    BMCWEB_LOG_DEBUG << "Boot enable: " << *bootEnable;
+    BMCWEB_LOG_DEBUG("Boot enable: {}", *bootEnable);
 
     bool bootOverrideEnable = false;
     bool bootOverridePersistent = false;
@@ -1711,16 +1705,16 @@
     }
     else
     {
-        BMCWEB_LOG_DEBUG
-            << "Invalid property value for BootSourceOverrideEnabled: "
-            << *bootEnable;
+        BMCWEB_LOG_DEBUG(
+            "Invalid property value for BootSourceOverrideEnabled: {}",
+            *bootEnable);
         messages::propertyValueNotInList(asyncResp->res, *bootEnable,
                                          "BootSourceOverrideEnabled");
         return;
     }
 
     // Act on validated parameters
-    BMCWEB_LOG_DEBUG << "DBUS boot override enable: " << bootOverrideEnable;
+    BMCWEB_LOG_DEBUG("DBUS boot override enable: {}", bootOverrideEnable);
 
     sdbusplus::asio::setProperty(
         *crow::connections::systemBus, "xyz.openbmc_project.Settings",
@@ -1729,11 +1723,11 @@
         [asyncResp](const boost::system::error_code& ec2) {
         if (ec2)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
+            BMCWEB_LOG_DEBUG("DBUS response error {}", ec2);
             messages::internalError(asyncResp->res);
             return;
         }
-        BMCWEB_LOG_DEBUG << "Boot override enable update done.";
+        BMCWEB_LOG_DEBUG("Boot override enable update done.");
         });
 
     if (!bootOverrideEnable)
@@ -1743,8 +1737,8 @@
 
     // In case boot override is enabled we need to set correct value for the
     // 'one_time' enable DBus interface
-    BMCWEB_LOG_DEBUG << "DBUS boot override persistent: "
-                     << bootOverridePersistent;
+    BMCWEB_LOG_DEBUG("DBUS boot override persistent: {}",
+                     bootOverridePersistent);
 
     sdbusplus::asio::setProperty(
         *crow::connections::systemBus, "xyz.openbmc_project.Settings",
@@ -1753,11 +1747,11 @@
         [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+            BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
-        BMCWEB_LOG_DEBUG << "Boot one_time update done.";
+        BMCWEB_LOG_DEBUG("Boot one_time update done.");
         });
 }
 
@@ -1782,22 +1776,22 @@
     }
 
     // Source target specified
-    BMCWEB_LOG_DEBUG << "Boot source: " << *bootSource;
+    BMCWEB_LOG_DEBUG("Boot source: {}", *bootSource);
     // Figure out which DBUS interface and property to use
     if (assignBootParameters(asyncResp, *bootSource, bootSourceStr,
                              bootModeStr) != 0)
     {
-        BMCWEB_LOG_DEBUG
-            << "Invalid property value for BootSourceOverrideTarget: "
-            << *bootSource;
+        BMCWEB_LOG_DEBUG(
+            "Invalid property value for BootSourceOverrideTarget: {}",
+            *bootSource);
         messages::propertyValueNotInList(asyncResp->res, *bootSource,
                                          "BootSourceTargetOverride");
         return;
     }
 
     // Act on validated parameters
-    BMCWEB_LOG_DEBUG << "DBUS boot source: " << bootSourceStr;
-    BMCWEB_LOG_DEBUG << "DBUS boot mode: " << bootModeStr;
+    BMCWEB_LOG_DEBUG("DBUS boot source: {}", bootSourceStr);
+    BMCWEB_LOG_DEBUG("DBUS boot mode: {}", bootModeStr);
 
     sdbusplus::asio::setProperty(
         *crow::connections::systemBus, "xyz.openbmc_project.Settings",
@@ -1806,11 +1800,11 @@
         [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+            BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
-        BMCWEB_LOG_DEBUG << "Boot source update done.";
+        BMCWEB_LOG_DEBUG("Boot source update done.");
         });
 
     sdbusplus::asio::setProperty(
@@ -1820,11 +1814,11 @@
         [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+            BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
-        BMCWEB_LOG_DEBUG << "Boot mode update done.";
+        BMCWEB_LOG_DEBUG("Boot mode update done.");
         });
 }
 
@@ -1845,7 +1839,7 @@
                       const std::optional<std::string>& bootType,
                       const std::optional<std::string>& bootEnable)
 {
-    BMCWEB_LOG_DEBUG << "Set boot information.";
+    BMCWEB_LOG_DEBUG("Set boot information.");
 
     setBootModeOrSource(asyncResp, bootSource);
     setBootType(asyncResp, bootType);
@@ -1872,13 +1866,13 @@
                    const dbus::utility::MapperGetSubTreeResponse& subtree) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "D-Bus response error on GetSubTree " << ec;
+            BMCWEB_LOG_DEBUG("D-Bus response error on GetSubTree {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
         if (subtree.empty())
         {
-            BMCWEB_LOG_DEBUG << "Can't find system D-Bus object!";
+            BMCWEB_LOG_DEBUG("Can't find system D-Bus object!");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -1886,13 +1880,13 @@
         // Throw an error if there is more than 1
         if (subtree.size() > 1)
         {
-            BMCWEB_LOG_DEBUG << "Found more than 1 system D-Bus object!";
+            BMCWEB_LOG_DEBUG("Found more than 1 system D-Bus object!");
             messages::internalError(asyncResp->res);
             return;
         }
         if (subtree[0].first.empty() || subtree[0].second.size() != 1)
         {
-            BMCWEB_LOG_DEBUG << "Asset Tag Set mapper error!";
+            BMCWEB_LOG_DEBUG("Asset Tag Set mapper error!");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -1902,7 +1896,7 @@
 
         if (service.empty())
         {
-            BMCWEB_LOG_DEBUG << "Asset Tag Set service mapper error!";
+            BMCWEB_LOG_DEBUG("Asset Tag Set service mapper error!");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -1913,8 +1907,8 @@
             assetTag, [asyncResp](const boost::system::error_code& ec2) {
                 if (ec2)
                 {
-                    BMCWEB_LOG_DEBUG << "D-Bus response error on AssetTag Set "
-                                     << ec2;
+                    BMCWEB_LOG_DEBUG("D-Bus response error on AssetTag Set {}",
+                                     ec2);
                     messages::internalError(asyncResp->res);
                     return;
                 }
@@ -1958,13 +1952,13 @@
 inline void setStopBootOnFault(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
                                const std::string& stopBootOnFault)
 {
-    BMCWEB_LOG_DEBUG << "Set Stop Boot On Fault.";
+    BMCWEB_LOG_DEBUG("Set Stop Boot On Fault.");
 
     std::optional<bool> stopBootEnabled = validstopBootOnFault(stopBootOnFault);
     if (!stopBootEnabled)
     {
-        BMCWEB_LOG_DEBUG << "Invalid property value for StopBootOnFault: "
-                         << stopBootOnFault;
+        BMCWEB_LOG_DEBUG("Invalid property value for StopBootOnFault: {}",
+                         stopBootOnFault);
         messages::propertyValueNotInList(aResp->res, stopBootOnFault,
                                          "StopBootOnFault");
         return;
@@ -1999,7 +1993,7 @@
     setAutomaticRetry(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                       const std::string& automaticRetryConfig)
 {
-    BMCWEB_LOG_DEBUG << "Set Automatic Retry.";
+    BMCWEB_LOG_DEBUG("Set Automatic Retry.");
 
     // OpenBMC only supports "Disabled" and "RetryAttempts".
     bool autoRebootEnabled = false;
@@ -2014,8 +2008,8 @@
     }
     else
     {
-        BMCWEB_LOG_DEBUG << "Invalid property value for AutomaticRetryConfig: "
-                         << automaticRetryConfig;
+        BMCWEB_LOG_DEBUG("Invalid property value for AutomaticRetryConfig: {}",
+                         automaticRetryConfig);
         messages::propertyValueNotInList(asyncResp->res, automaticRetryConfig,
                                          "AutomaticRetryConfig");
         return;
@@ -2063,7 +2057,7 @@
     setPowerRestorePolicy(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                           std::string_view policy)
 {
-    BMCWEB_LOG_DEBUG << "Set power restore policy.";
+    BMCWEB_LOG_DEBUG("Set power restore policy.");
 
     std::string powerRestorePolicy = dbusPowerRestorePolicyFromRedfish(policy);
 
@@ -2097,7 +2091,7 @@
  */
 inline void getProvisioningStatus(std::shared_ptr<bmcweb::AsyncResp> asyncResp)
 {
-    BMCWEB_LOG_DEBUG << "Get OEM information.";
+    BMCWEB_LOG_DEBUG("Get OEM information.");
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, "xyz.openbmc_project.PFR.Manager",
         "/xyz/openbmc_project/pfr", "xyz.openbmc_project.PFR.Attributes",
@@ -2111,7 +2105,7 @@
 
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+            BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
             // not an error, don't have to have the interface
             oemPFR["ProvisioningStatus"] = "NotProvisioned";
             return;
@@ -2132,7 +2126,7 @@
 
         if ((provState == nullptr) || (lockState == nullptr))
         {
-            BMCWEB_LOG_DEBUG << "Unable to get PFR attributes.";
+            BMCWEB_LOG_DEBUG("Unable to get PFR attributes.");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -2191,7 +2185,7 @@
     else
     {
         // Any other values would be invalid
-        BMCWEB_LOG_DEBUG << "PowerMode value was not valid: " << modeValue;
+        BMCWEB_LOG_DEBUG("PowerMode value was not valid: {}", modeValue);
         messages::internalError(asyncResp->res);
     }
 }
@@ -2205,7 +2199,7 @@
  */
 inline void getPowerMode(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
-    BMCWEB_LOG_DEBUG << "Get power mode.";
+    BMCWEB_LOG_DEBUG("Get power mode.");
 
     // Get Power Mode object path:
     constexpr std::array<std::string_view, 1> interfaces = {
@@ -2216,8 +2210,8 @@
                     const dbus::utility::MapperGetSubTreeResponse& subtree) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error on Power.Mode GetSubTree "
-                             << ec;
+            BMCWEB_LOG_DEBUG("DBUS response error on Power.Mode GetSubTree {}",
+                             ec);
             // This is an optional D-Bus object so just return if
             // error occurs
             return;
@@ -2232,15 +2226,15 @@
         {
             // More then one PowerMode object is not supported and is an
             // error
-            BMCWEB_LOG_DEBUG
-                << "Found more than 1 system D-Bus Power.Mode objects: "
-                << subtree.size();
+            BMCWEB_LOG_DEBUG(
+                "Found more than 1 system D-Bus Power.Mode objects: {}",
+                subtree.size());
             messages::internalError(asyncResp->res);
             return;
         }
         if ((subtree[0].first.empty()) || (subtree[0].second.size() != 1))
         {
-            BMCWEB_LOG_DEBUG << "Power.Mode mapper error!";
+            BMCWEB_LOG_DEBUG("Power.Mode mapper error!");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -2248,7 +2242,7 @@
         const std::string& service = subtree[0].second.begin()->first;
         if (service.empty())
         {
-            BMCWEB_LOG_DEBUG << "Power.Mode service mapper error!";
+            BMCWEB_LOG_DEBUG("Power.Mode service mapper error!");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -2260,8 +2254,8 @@
                         const std::string& pmode) {
             if (ec2)
             {
-                BMCWEB_LOG_DEBUG << "DBUS response error on PowerMode Get: "
-                                 << ec2;
+                BMCWEB_LOG_DEBUG("DBUS response error on PowerMode Get: {}",
+                                 ec2);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -2269,7 +2263,7 @@
             asyncResp->res.jsonValue["PowerMode@Redfish.AllowableValues"] = {
                 "Static", "MaximumPerformance", "PowerSaving"};
 
-            BMCWEB_LOG_DEBUG << "Current power mode: " << pmode;
+            BMCWEB_LOG_DEBUG("Current power mode: {}", pmode);
             translatePowerMode(asyncResp, pmode);
             });
         });
@@ -2322,7 +2316,7 @@
 inline void setPowerMode(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
                          const std::string& pmode)
 {
-    BMCWEB_LOG_DEBUG << "Set power mode.";
+    BMCWEB_LOG_DEBUG("Set power mode.");
 
     std::string powerMode = validatePowerMode(asyncResp, pmode);
     if (powerMode.empty())
@@ -2340,8 +2334,8 @@
                     const dbus::utility::MapperGetSubTreeResponse& subtree) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error on Power.Mode GetSubTree "
-                             << ec;
+            BMCWEB_LOG_DEBUG("DBUS response error on Power.Mode GetSubTree {}",
+                             ec);
             // This is an optional D-Bus object, but user attempted to patch
             messages::internalError(asyncResp->res);
             return;
@@ -2357,15 +2351,15 @@
         {
             // More then one PowerMode object is not supported and is an
             // error
-            BMCWEB_LOG_DEBUG
-                << "Found more than 1 system D-Bus Power.Mode objects: "
-                << subtree.size();
+            BMCWEB_LOG_DEBUG(
+                "Found more than 1 system D-Bus Power.Mode objects: {}",
+                subtree.size());
             messages::internalError(asyncResp->res);
             return;
         }
         if ((subtree[0].first.empty()) || (subtree[0].second.size() != 1))
         {
-            BMCWEB_LOG_DEBUG << "Power.Mode mapper error!";
+            BMCWEB_LOG_DEBUG("Power.Mode mapper error!");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -2373,13 +2367,12 @@
         const std::string& service = subtree[0].second.begin()->first;
         if (service.empty())
         {
-            BMCWEB_LOG_DEBUG << "Power.Mode service mapper error!";
+            BMCWEB_LOG_DEBUG("Power.Mode service mapper error!");
             messages::internalError(asyncResp->res);
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "Setting power mode(" << powerMode << ") -> "
-                         << path;
+        BMCWEB_LOG_DEBUG("Setting power mode({}) -> {}", powerMode, path);
 
         // Set the Power Mode property
         sdbusplus::asio::setProperty(
@@ -2466,7 +2459,7 @@
 inline void
     getHostWatchdogTimer(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
-    BMCWEB_LOG_DEBUG << "Get host watchodg";
+    BMCWEB_LOG_DEBUG("Get host watchodg");
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, "xyz.openbmc_project.Watchdog",
         "/xyz/openbmc_project/watchdog/host0",
@@ -2476,11 +2469,11 @@
         if (ec)
         {
             // watchdog service is stopped
-            BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+            BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "Got " << properties.size() << " wdt prop.";
+        BMCWEB_LOG_DEBUG("Got {} wdt prop.", properties.size());
 
         nlohmann::json& hostWatchdogTimer =
             asyncResp->res.jsonValue["HostWatchdogTimer"];
@@ -2534,7 +2527,7 @@
                      const std::optional<bool> wdtEnable,
                      const std::optional<std::string>& wdtTimeOutAction)
 {
-    BMCWEB_LOG_DEBUG << "Set host watchdog";
+    BMCWEB_LOG_DEBUG("Set host watchdog");
 
     if (wdtTimeOutAction)
     {
@@ -2542,8 +2535,8 @@
         // check if TimeOut Action is Valid
         if (wdtTimeOutActStr.empty())
         {
-            BMCWEB_LOG_DEBUG << "Unsupported value for TimeoutAction: "
-                             << *wdtTimeOutAction;
+            BMCWEB_LOG_DEBUG("Unsupported value for TimeoutAction: {}",
+                             *wdtTimeOutAction);
             messages::propertyValueNotInList(asyncResp->res, *wdtTimeOutAction,
                                              "TimeoutAction");
             return;
@@ -2556,7 +2549,7 @@
             wdtTimeOutActStr, [asyncResp](const boost::system::error_code& ec) {
                 if (ec)
                 {
-                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+                    BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
                     messages::internalError(asyncResp->res);
                     return;
                 }
@@ -2572,7 +2565,7 @@
             [asyncResp](const boost::system::error_code& ec) {
             if (ec)
             {
-                BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+                BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -2655,7 +2648,7 @@
 inline void
     getIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
-    BMCWEB_LOG_DEBUG << "Get idle power saver parameters";
+    BMCWEB_LOG_DEBUG("Get idle power saver parameters");
 
     // Get IdlePowerSaver object path:
     constexpr std::array<std::string_view, 1> interfaces = {
@@ -2666,9 +2659,9 @@
                     const dbus::utility::MapperGetSubTreeResponse& subtree) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG
-                << "DBUS response error on Power.IdlePowerSaver GetSubTree "
-                << ec;
+            BMCWEB_LOG_DEBUG(
+                "DBUS response error on Power.IdlePowerSaver GetSubTree {}",
+                ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -2676,22 +2669,22 @@
         {
             // This is an optional interface so just return
             // if there is no instance found
-            BMCWEB_LOG_DEBUG << "No instances found";
+            BMCWEB_LOG_DEBUG("No instances found");
             return;
         }
         if (subtree.size() > 1)
         {
             // More then one PowerIdlePowerSaver object is not supported and
             // is an error
-            BMCWEB_LOG_DEBUG << "Found more than 1 system D-Bus "
-                                "Power.IdlePowerSaver objects: "
-                             << subtree.size();
+            BMCWEB_LOG_DEBUG("Found more than 1 system D-Bus "
+                             "Power.IdlePowerSaver objects: {}",
+                             subtree.size());
             messages::internalError(asyncResp->res);
             return;
         }
         if ((subtree[0].first.empty()) || (subtree[0].second.size() != 1))
         {
-            BMCWEB_LOG_DEBUG << "Power.IdlePowerSaver mapper error!";
+            BMCWEB_LOG_DEBUG("Power.IdlePowerSaver mapper error!");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -2699,7 +2692,7 @@
         const std::string& service = subtree[0].second.begin()->first;
         if (service.empty())
         {
-            BMCWEB_LOG_DEBUG << "Power.IdlePowerSaver service mapper error!";
+            BMCWEB_LOG_DEBUG("Power.IdlePowerSaver service mapper error!");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -2712,8 +2705,8 @@
                         const dbus::utility::DBusPropertiesMap& properties) {
             if (ec2)
             {
-                BMCWEB_LOG_ERROR
-                    << "DBUS response error on IdlePowerSaver GetAll: " << ec2;
+                BMCWEB_LOG_ERROR(
+                    "DBUS response error on IdlePowerSaver GetAll: {}", ec2);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -2726,7 +2719,7 @@
             });
         });
 
-    BMCWEB_LOG_DEBUG << "EXIT: Get idle power saver parameters";
+    BMCWEB_LOG_DEBUG("EXIT: Get idle power saver parameters");
 }
 
 /**
@@ -2752,7 +2745,7 @@
                       const std::optional<uint8_t> ipsExitUtil,
                       const std::optional<uint64_t> ipsExitTime)
 {
-    BMCWEB_LOG_DEBUG << "Set idle power saver properties";
+    BMCWEB_LOG_DEBUG("Set idle power saver properties");
 
     // Get IdlePowerSaver object path:
     constexpr std::array<std::string_view, 1> interfaces = {
@@ -2764,9 +2757,9 @@
                       const dbus::utility::MapperGetSubTreeResponse& subtree) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG
-                << "DBUS response error on Power.IdlePowerSaver GetSubTree "
-                << ec;
+            BMCWEB_LOG_DEBUG(
+                "DBUS response error on Power.IdlePowerSaver GetSubTree {}",
+                ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -2781,15 +2774,15 @@
         {
             // More then one PowerIdlePowerSaver object is not supported and
             // is an error
-            BMCWEB_LOG_DEBUG
-                << "Found more than 1 system D-Bus Power.IdlePowerSaver objects: "
-                << subtree.size();
+            BMCWEB_LOG_DEBUG(
+                "Found more than 1 system D-Bus Power.IdlePowerSaver objects: {}",
+                subtree.size());
             messages::internalError(asyncResp->res);
             return;
         }
         if ((subtree[0].first.empty()) || (subtree[0].second.size() != 1))
         {
-            BMCWEB_LOG_DEBUG << "Power.IdlePowerSaver mapper error!";
+            BMCWEB_LOG_DEBUG("Power.IdlePowerSaver mapper error!");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -2797,7 +2790,7 @@
         const std::string& service = subtree[0].second.begin()->first;
         if (service.empty())
         {
-            BMCWEB_LOG_DEBUG << "Power.IdlePowerSaver service mapper error!";
+            BMCWEB_LOG_DEBUG("Power.IdlePowerSaver service mapper error!");
             messages::internalError(asyncResp->res);
             return;
         }
@@ -2813,7 +2806,7 @@
                 *ipsEnable, [asyncResp](const boost::system::error_code& ec2) {
                     if (ec2)
                     {
-                        BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
+                        BMCWEB_LOG_DEBUG("DBUS response error {}", ec2);
                         messages::internalError(asyncResp->res);
                         return;
                     }
@@ -2828,7 +2821,7 @@
                 [asyncResp](const boost::system::error_code& ec2) {
                 if (ec2)
                 {
-                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
+                    BMCWEB_LOG_DEBUG("DBUS response error {}", ec2);
                     messages::internalError(asyncResp->res);
                     return;
                 }
@@ -2845,7 +2838,7 @@
                 [asyncResp](const boost::system::error_code& ec2) {
                 if (ec2)
                 {
-                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
+                    BMCWEB_LOG_DEBUG("DBUS response error {}", ec2);
                     messages::internalError(asyncResp->res);
                     return;
                 }
@@ -2860,7 +2853,7 @@
                 [asyncResp](const boost::system::error_code& ec2) {
                 if (ec2)
                 {
-                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
+                    BMCWEB_LOG_DEBUG("DBUS response error {}", ec2);
                     messages::internalError(asyncResp->res);
                     return;
                 }
@@ -2877,7 +2870,7 @@
                 [asyncResp](const boost::system::error_code& ec2) {
                 if (ec2)
                 {
-                    BMCWEB_LOG_DEBUG << "DBUS response error " << ec2;
+                    BMCWEB_LOG_DEBUG("DBUS response error {}", ec2);
                     messages::internalError(asyncResp->res);
                     return;
                 }
@@ -2885,7 +2878,7 @@
         }
         });
 
-    BMCWEB_LOG_DEBUG << "EXIT: Set idle power saver parameters";
+    BMCWEB_LOG_DEBUG("EXIT: Set idle power saver parameters");
 }
 
 inline void handleComputerSystemCollectionHead(
@@ -2943,17 +2936,17 @@
         auto val = asyncResp->res.jsonValue.find("Members@odata.count");
         if (val == asyncResp->res.jsonValue.end())
         {
-            BMCWEB_LOG_CRITICAL << "Count wasn't found??";
+            BMCWEB_LOG_CRITICAL("Count wasn't found??");
             return;
         }
         uint64_t* count = val->get_ptr<uint64_t*>();
         if (count == nullptr)
         {
-            BMCWEB_LOG_CRITICAL << "Count wasn't found??";
+            BMCWEB_LOG_CRITICAL("Count wasn't found??");
             return;
         }
         *count = *count + 1;
-        BMCWEB_LOG_DEBUG << "Hypervisor is available";
+        BMCWEB_LOG_DEBUG("Hypervisor is available");
         nlohmann::json& ifaceArray2 = asyncResp->res.jsonValue["Members"];
         nlohmann::json::object_t hypervisor;
         hypervisor["@odata.id"] = "/redfish/v1/Systems/hypervisor";
@@ -2976,7 +2969,7 @@
         [asyncResp](const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << " Bad D-Bus request error: " << ec;
+            BMCWEB_LOG_ERROR(" Bad D-Bus request error: {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
@@ -3001,7 +2994,7 @@
 
     if (eMsg.get_error() == nullptr)
     {
-        BMCWEB_LOG_ERROR << "D-Bus response error: " << ec;
+        BMCWEB_LOG_ERROR("D-Bus response error: {}", ec);
         messages::internalError(res);
         return;
     }
@@ -3015,13 +3008,13 @@
         (errorMessage ==
          std::string_view("xyz.openbmc_project.State.Host.Error.BMCNotReady")))
     {
-        BMCWEB_LOG_DEBUG << "BMC not ready, operation not allowed right now";
+        BMCWEB_LOG_DEBUG("BMC not ready, operation not allowed right now");
         messages::serviceTemporarilyUnavailable(res, "10");
         return;
     }
 
-    BMCWEB_LOG_ERROR << "System Action Reset transition fail " << ec
-                     << " sdbusplus:" << errorMessage;
+    BMCWEB_LOG_ERROR("System Action Reset transition fail {} sdbusplus:{}", ec,
+                     errorMessage);
     messages::internalError(res);
 }
 
diff --git a/redfish-core/lib/task.hpp b/redfish-core/lib/task.hpp
index 050b75c..8a5c30b 100644
--- a/redfish-core/lib/task.hpp
+++ b/redfish-core/lib/task.hpp
@@ -265,7 +265,7 @@
         }
         else
         {
-            BMCWEB_LOG_INFO << "sendTaskEvent: No events to send";
+            BMCWEB_LOG_INFO("sendTaskEvent: No events to send");
         }
     }
 
diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp
index 9cc5ccb..42e66c9 100644
--- a/redfish-core/lib/telemetry_service.hpp
+++ b/redfish-core/lib/telemetry_service.hpp
@@ -48,7 +48,7 @@
         }
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
+            BMCWEB_LOG_ERROR("respHandler DBus error {}", ec);
             messages::internalError(asyncResp->res);
             return;
         }
diff --git a/redfish-core/lib/thermal_subsystem.hpp b/redfish-core/lib/thermal_subsystem.hpp
index 804b849..92e623e 100644
--- a/redfish-core/lib/thermal_subsystem.hpp
+++ b/redfish-core/lib/thermal_subsystem.hpp
@@ -22,7 +22,7 @@
 {
     if (!validChassisPath)
     {
-        BMCWEB_LOG_WARNING << "Not a valid chassis ID" << chassisId;
+        BMCWEB_LOG_WARNING("Not a valid chassis ID{}", chassisId);
         messages::resourceNotFound(asyncResp->res, "Chassis", chassisId);
         return;
     }
diff --git a/redfish-core/lib/trigger.hpp b/redfish-core/lib/trigger.hpp
index cd1b60f..48e348e 100644
--- a/redfish-core/lib/trigger.hpp
+++ b/redfish-core/lib/trigger.hpp
@@ -678,7 +678,7 @@
     if (ec)
     {
         messages::internalError(asyncResp->res);
-        BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
+        BMCWEB_LOG_ERROR("respHandler DBus error {}", ec);
         return;
     }
 
@@ -687,8 +687,8 @@
     if (!triggerId)
     {
         messages::internalError(asyncResp->res);
-        BMCWEB_LOG_ERROR << "Unknown data returned by "
-                            "AddTrigger DBus method";
+        BMCWEB_LOG_ERROR("Unknown data returned by "
+                         "AddTrigger DBus method");
         return;
     }
 
@@ -791,8 +791,8 @@
         if (reportId.empty())
         {
             {
-                BMCWEB_LOG_ERROR << "Property Reports contains invalid value: "
-                                 << path.str;
+                BMCWEB_LOG_ERROR("Property Reports contains invalid value: {}",
+                                 path.str);
                 return std::nullopt;
             }
         }
@@ -848,8 +848,8 @@
             getTriggerActions(*triggerActions);
         if (!redfishTriggerActions)
         {
-            BMCWEB_LOG_ERROR
-                << "Property TriggerActions is invalid in Trigger: " << id;
+            BMCWEB_LOG_ERROR(
+                "Property TriggerActions is invalid in Trigger: {}", id);
             return false;
         }
         json["TriggerActions"] = *redfishTriggerActions;
@@ -861,8 +861,7 @@
             getMetricReportDefinitions(*reports);
         if (!linkedReports)
         {
-            BMCWEB_LOG_ERROR << "Property Reports is invalid in Trigger: "
-                             << id;
+            BMCWEB_LOG_ERROR("Property Reports is invalid in Trigger: {}", id);
             return false;
         }
         json["Links"]["MetricReportDefinitions"] = *linkedReports;
@@ -877,10 +876,9 @@
 
             if (!discreteTriggers)
             {
-                BMCWEB_LOG_ERROR
-                    << "Property Thresholds is invalid for discrete "
-                       "triggers in Trigger: "
-                    << id;
+                BMCWEB_LOG_ERROR("Property Thresholds is invalid for discrete "
+                                 "triggers in Trigger: {}",
+                                 id);
                 return false;
             }
 
@@ -896,10 +894,9 @@
 
             if (!numericThresholds)
             {
-                BMCWEB_LOG_ERROR
-                    << "Property Thresholds is invalid for numeric "
-                       "thresholds in Trigger: "
-                    << id;
+                BMCWEB_LOG_ERROR("Property Thresholds is invalid for numeric "
+                                 "thresholds in Trigger: {}",
+                                 id);
                 return false;
             }
 
@@ -1012,7 +1009,7 @@
             }
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
+                BMCWEB_LOG_ERROR("respHandler DBus error {}", ec);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -1046,7 +1043,7 @@
 
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
+                BMCWEB_LOG_ERROR("respHandler DBus error {}", ec);
                 messages::internalError(asyncResp->res);
                 return;
             }
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index 357c047..3e75425 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -63,7 +63,7 @@
 inline static void activateImage(const std::string& objPath,
                                  const std::string& service)
 {
-    BMCWEB_LOG_DEBUG << "Activate image for " << objPath << " " << service;
+    BMCWEB_LOG_DEBUG("Activate image for {} {}", objPath, service);
     sdbusplus::asio::setProperty(
         *crow::connections::systemBus, service, objPath,
         "xyz.openbmc_project.Software.Activation", "RequestedActivation",
@@ -71,8 +71,8 @@
         [](const boost::system::error_code& ec) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "error_code = " << ec;
-            BMCWEB_LOG_DEBUG << "error msg = " << ec.message();
+            BMCWEB_LOG_DEBUG("error_code = {}", ec);
+            BMCWEB_LOG_DEBUG("error msg = {}", ec.message());
         }
         });
 }
@@ -89,10 +89,10 @@
 
     m.read(objPath, interfacesProperties);
 
-    BMCWEB_LOG_DEBUG << "obj path = " << objPath.str;
+    BMCWEB_LOG_DEBUG("obj path = {}", objPath.str);
     for (const auto& interface : interfacesProperties)
     {
-        BMCWEB_LOG_DEBUG << "interface = " << interface.first;
+        BMCWEB_LOG_DEBUG("interface = {}", interface.first);
 
         if (interface.first == "xyz.openbmc_project.Software.Activation")
         {
@@ -108,8 +108,8 @@
                         objInfo) mutable {
                 if (ec)
                 {
-                    BMCWEB_LOG_DEBUG << "error_code = " << ec;
-                    BMCWEB_LOG_DEBUG << "error msg = " << ec.message();
+                    BMCWEB_LOG_DEBUG("error_code = {}", ec);
+                    BMCWEB_LOG_DEBUG("error msg = {}", ec.message());
                     if (asyncResp)
                     {
                         messages::internalError(asyncResp->res);
@@ -120,8 +120,7 @@
                 // Ensure we only got one service back
                 if (objInfo.size() != 1)
                 {
-                    BMCWEB_LOG_ERROR << "Invalid Object Size "
-                                     << objInfo.size();
+                    BMCWEB_LOG_ERROR("Invalid Object Size {}", objInfo.size());
                     if (asyncResp)
                     {
                         messages::internalError(asyncResp->res);
@@ -295,12 +294,11 @@
             // expected, we were canceled before the timer completed.
             return;
         }
-        BMCWEB_LOG_ERROR
-            << "Timed out waiting for firmware object being created";
-        BMCWEB_LOG_ERROR << "FW image may has already been uploaded to server";
+        BMCWEB_LOG_ERROR("Timed out waiting for firmware object being created");
+        BMCWEB_LOG_ERROR("FW image may has already been uploaded to server");
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "Async_wait failed" << ec;
+            BMCWEB_LOG_ERROR("Async_wait failed{}", ec);
             return;
         }
         if (asyncResp)
@@ -310,7 +308,7 @@
     });
     task::Payload payload(req);
     auto callback = [asyncResp, payload](sdbusplus::message_t& m) mutable {
-        BMCWEB_LOG_DEBUG << "Match fired";
+        BMCWEB_LOG_DEBUG("Match fired");
         softwareInterfaceAdded(asyncResp, m, std::move(payload));
     };
 
@@ -332,7 +330,7 @@
             interfacesProperties;
         sdbusplus::message::object_path objPath;
         m.read(objPath, interfacesProperties);
-        BMCWEB_LOG_DEBUG << "obj path = " << objPath.str;
+        BMCWEB_LOG_DEBUG("obj path = {}", objPath.str);
         for (const std::pair<std::string, dbus::utility::DBusPropertiesMap>&
                  interface : interfacesProperties)
         {
@@ -423,7 +421,7 @@
         std::optional<std::string> transferProtocol;
         std::string imageURI;
 
-        BMCWEB_LOG_DEBUG << "Enter UpdateService.SimpleUpdate doPost";
+        BMCWEB_LOG_DEBUG("Enter UpdateService.SimpleUpdate doPost");
 
         // User can pass in both TransferProtocol and ImageURI parameters or
         // they can pass in just the ImageURI with the transfer protocol
@@ -434,8 +432,7 @@
         if (!json_util::readJsonAction(req, asyncResp->res, "TransferProtocol",
                                        transferProtocol, "ImageURI", imageURI))
         {
-            BMCWEB_LOG_DEBUG
-                << "Missing TransferProtocol or ImageURI parameter";
+            BMCWEB_LOG_DEBUG("Missing TransferProtocol or ImageURI parameter");
             return;
         }
         if (!transferProtocol)
@@ -449,22 +446,21 @@
                 messages::actionParameterValueTypeError(
                     asyncResp->res, imageURI, "ImageURI",
                     "UpdateService.SimpleUpdate");
-                BMCWEB_LOG_ERROR << "ImageURI missing transfer protocol: "
-                                 << imageURI;
+                BMCWEB_LOG_ERROR("ImageURI missing transfer protocol: {}",
+                                 imageURI);
                 return;
             }
             transferProtocol = imageURI.substr(0, separator);
             // Ensure protocol is upper case for a common comparison path
             // below
             boost::to_upper(*transferProtocol);
-            BMCWEB_LOG_DEBUG << "Encoded transfer protocol "
-                             << *transferProtocol;
+            BMCWEB_LOG_DEBUG("Encoded transfer protocol {}", *transferProtocol);
 
             // Adjust imageURI to not have the protocol on it for parsing
             // below
             // ex. tftp://1.1.1.1/myfile.bin -> 1.1.1.1/myfile.bin
             imageURI = imageURI.substr(separator + 3);
-            BMCWEB_LOG_DEBUG << "Adjusted imageUri " << imageURI;
+            BMCWEB_LOG_DEBUG("Adjusted imageUri {}", imageURI);
         }
 
         // OpenBMC currently only supports TFTP
@@ -473,8 +469,8 @@
             messages::actionParameterNotSupported(asyncResp->res,
                                                   "TransferProtocol",
                                                   "UpdateService.SimpleUpdate");
-            BMCWEB_LOG_ERROR << "Request incorrect protocol parameter: "
-                             << *transferProtocol;
+            BMCWEB_LOG_ERROR("Request incorrect protocol parameter: {}",
+                             *transferProtocol);
             return;
         }
 
@@ -486,13 +482,13 @@
             messages::actionParameterValueTypeError(
                 asyncResp->res, imageURI, "ImageURI",
                 "UpdateService.SimpleUpdate");
-            BMCWEB_LOG_ERROR << "Invalid ImageURI: " << imageURI;
+            BMCWEB_LOG_ERROR("Invalid ImageURI: {}", imageURI);
             return;
         }
 
         std::string tftpServer = imageURI.substr(0, separator);
         std::string fwFile = imageURI.substr(separator + 1);
-        BMCWEB_LOG_DEBUG << "Server: " << tftpServer + " File: " << fwFile;
+        BMCWEB_LOG_DEBUG("Server: {}{}", tftpServer + " File: ", fwFile);
 
         // Setup callback for when new software detected
         // Give TFTP 10 minutes to complete
@@ -514,19 +510,19 @@
             {
                 // messages::internalError(asyncResp->res);
                 cleanUp();
-                BMCWEB_LOG_DEBUG << "error_code = " << ec;
-                BMCWEB_LOG_DEBUG << "error msg = " << ec.message();
+                BMCWEB_LOG_DEBUG("error_code = {}", ec);
+                BMCWEB_LOG_DEBUG("error msg = {}", ec.message());
             }
             else
             {
-                BMCWEB_LOG_DEBUG << "Call to DownloaViaTFTP Success";
+                BMCWEB_LOG_DEBUG("Call to DownloaViaTFTP Success");
             }
             },
             "xyz.openbmc_project.Software.Download",
             "/xyz/openbmc_project/software", "xyz.openbmc_project.Common.TFTP",
             "DownloadViaTFTP", fwFile, tftpServer);
 
-        BMCWEB_LOG_DEBUG << "Exit UpdateService.SimpleUpdate doPost";
+        BMCWEB_LOG_DEBUG("Exit UpdateService.SimpleUpdate doPost");
         });
 }
 
@@ -534,7 +530,7 @@
 {
     std::filesystem::path filepath("/tmp/images/" + bmcweb::getRandomUUID());
 
-    BMCWEB_LOG_DEBUG << "Writing file to " << filepath;
+    BMCWEB_LOG_DEBUG("Writing file to {}", filepath.string());
     std::ofstream out(filepath, std::ofstream::out | std::ofstream::binary |
                                     std::ofstream::trunc);
     // set the permission of the file to 640
@@ -566,8 +562,8 @@
     }
     else
     {
-        BMCWEB_LOG_INFO
-            << "ApplyTime value is not in the list of acceptable values";
+        BMCWEB_LOG_INFO(
+            "ApplyTime value is not in the list of acceptable values");
         messages::propertyValueNotInList(asyncResp->res, applyTime,
                                          "ApplyTime");
         return;
@@ -581,7 +577,7 @@
         applyTimeNewVal, [asyncResp](const boost::system::error_code& ec) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec;
+                BMCWEB_LOG_ERROR("D-Bus responses error: {}", ec);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -602,10 +598,10 @@
             formpart.fields.find("Content-Disposition");
         if (it == formpart.fields.end())
         {
-            BMCWEB_LOG_ERROR << "Couldn't find Content-Disposition";
+            BMCWEB_LOG_ERROR("Couldn't find Content-Disposition");
             return;
         }
-        BMCWEB_LOG_INFO << "Parsing value " << it->value();
+        BMCWEB_LOG_INFO("Parsing value {}", it->value());
 
         // The construction parameters of param_list must start with `;`
         size_t index = it->value().find(';');
@@ -656,7 +652,7 @@
 
     if (uploadData == nullptr)
     {
-        BMCWEB_LOG_ERROR << "Upload data is NULL";
+        BMCWEB_LOG_ERROR("Upload data is NULL");
         messages::propertyMissing(asyncResp->res, "UpdateFile");
         return;
     }
@@ -681,7 +677,7 @@
     }
     std::string_view contentType = req.getHeaderValue("Content-Type");
 
-    BMCWEB_LOG_DEBUG << "doPost: contentType=" << contentType;
+    BMCWEB_LOG_DEBUG("doPost: contentType={}", contentType);
 
     // Make sure that content type is application/octet-stream or
     // multipart/form-data
@@ -705,8 +701,8 @@
         if (ec != ParserError::PARSER_SUCCESS)
         {
             // handle error
-            BMCWEB_LOG_ERROR << "MIME parse failed, ec : "
-                             << static_cast<int>(ec);
+            BMCWEB_LOG_ERROR("MIME parse failed, ec : {}",
+                             static_cast<int>(ec));
             messages::internalError(asyncResp->res);
             return;
         }
@@ -714,7 +710,7 @@
     }
     else
     {
-        BMCWEB_LOG_DEBUG << "Bad content type specified:" << contentType;
+        BMCWEB_LOG_DEBUG("Bad content type specified:{}", contentType);
         asyncResp->res.result(boost::beast::http::status::bad_request);
     }
 }
@@ -768,7 +764,7 @@
                         const std::string& applyTime) {
             if (ec)
             {
-                BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
+                BMCWEB_LOG_DEBUG("DBUS response error {}", ec);
                 messages::internalError(asyncResp->res);
                 return;
             }
@@ -799,7 +795,7 @@
         {
             return;
         }
-        BMCWEB_LOG_DEBUG << "doPatch...";
+        BMCWEB_LOG_DEBUG("doPatch...");
 
         std::optional<nlohmann::json> pushUriOptions;
         if (!json_util::readJsonPatch(req, asyncResp->res, "HttpPushUriOptions",
@@ -890,7 +886,7 @@
     }
     else
     {
-        BMCWEB_LOG_ERROR << "Unknown software purpose " << purpose;
+        BMCWEB_LOG_ERROR("Unknown software purpose {}", purpose);
     }
 }
 
@@ -926,16 +922,16 @@
 
         if (swInvPurpose == nullptr)
         {
-            BMCWEB_LOG_DEBUG << "Can't find property \"Purpose\"!";
+            BMCWEB_LOG_DEBUG("Can't find property \"Purpose\"!");
             messages::internalError(asyncResp->res);
             return;
         }
 
-        BMCWEB_LOG_DEBUG << "swInvPurpose = " << *swInvPurpose;
+        BMCWEB_LOG_DEBUG("swInvPurpose = {}", *swInvPurpose);
 
         if (version == nullptr)
         {
-            BMCWEB_LOG_DEBUG << "Can't find property \"Version\"!";
+            BMCWEB_LOG_DEBUG("Can't find property \"Version\"!");
 
             messages::internalError(asyncResp->res);
 
@@ -991,7 +987,7 @@
             [asyncResp,
              swId](const boost::system::error_code& ec,
                    const dbus::utility::MapperGetSubTreeResponse& subtree) {
-            BMCWEB_LOG_DEBUG << "doGet callback...";
+            BMCWEB_LOG_DEBUG("doGet callback...");
             if (ec)
             {
                 messages::internalError(asyncResp->res);
@@ -1022,7 +1018,7 @@
             }
             if (!found)
             {
-                BMCWEB_LOG_WARNING << "Input swID " << *swId << " not found!";
+                BMCWEB_LOG_WARNING("Input swID {} not found!", *swId);
                 messages::resourceMissingAtURI(
                     asyncResp->res,
                     boost::urls::format(
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index 81af41f..e425cc1 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -46,8 +46,7 @@
                               const std::string& resName)
 {
     std::string thisPath = itemPath.filename();
-    BMCWEB_LOG_DEBUG << "Filename: " << itemPath.str
-                     << ", ThisPath: " << thisPath;
+    BMCWEB_LOG_DEBUG("Filename: {}, ThisPath: {}", itemPath.str, thisPath);
 
     if (thisPath.empty())
     {
@@ -102,7 +101,7 @@
                   const dbus::utility::ManagedObjectType& subtree) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error";
+            BMCWEB_LOG_DEBUG("DBUS response error");
 
             return;
         }
@@ -117,7 +116,7 @@
             }
         }
 
-        BMCWEB_LOG_DEBUG << "Parent item not found";
+        BMCWEB_LOG_DEBUG("Parent item not found");
         asyncResp->res.result(boost::beast::http::status::not_found);
         });
 }
@@ -224,7 +223,7 @@
                     const bool* activeValue = std::get_if<bool>(&value);
                     if (activeValue == nullptr)
                     {
-                        BMCWEB_LOG_DEBUG << "Value Active not found";
+                        BMCWEB_LOG_DEBUG("Value Active not found");
                         return;
                     }
                     asyncResp->res.jsonValue["Inserted"] = *activeValue;
@@ -272,7 +271,7 @@
                               const std::string& service,
                               const std::string& name)
 {
-    BMCWEB_LOG_DEBUG << "Get available Virtual Media resources.";
+    BMCWEB_LOG_DEBUG("Get available Virtual Media resources.");
     sdbusplus::message::object_path objPath(
         "/xyz/openbmc_project/VirtualMedia");
     dbus::utility::getManagedObjects(
@@ -282,7 +281,7 @@
             const dbus::utility::ManagedObjectType& subtree) {
         if (ec)
         {
-            BMCWEB_LOG_DEBUG << "DBUS response error";
+            BMCWEB_LOG_DEBUG("DBUS response error");
             return;
         }
         nlohmann::json& members = asyncResp->res.jsonValue["Members"];
@@ -344,7 +343,7 @@
                       const std::string& service, const std::string& name,
                       const std::string& resName)
 {
-    BMCWEB_LOG_DEBUG << "Get Virtual Media resource data.";
+    BMCWEB_LOG_DEBUG("Get Virtual Media resource data.");
 
     findAndParseObject(service, resName, asyncResp,
                        std::bind_front(afterGetVmData, name));
@@ -601,7 +600,7 @@
         if (credentials.user().size() + credentials.password().size() + 2 >
             secretLimit)
         {
-            BMCWEB_LOG_ERROR << "Credentials too long to handle";
+            BMCWEB_LOG_ERROR("Credentials too long to handle");
             messages::unrecognizedRequestBody(asyncResp->res);
             return;
         }
@@ -625,7 +624,7 @@
             [asyncResp](const boost::system::error_code& ec, std::size_t) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "Failed to pass secret: " << ec;
+                BMCWEB_LOG_ERROR("Failed to pass secret: {}", ec);
                 messages::internalError(asyncResp->res);
             }
         });
@@ -636,12 +635,12 @@
                                 bool success) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec;
+            BMCWEB_LOG_ERROR("Bad D-Bus request error: {}", ec);
             messages::internalError(asyncResp->res);
         }
         else if (!success)
         {
-            BMCWEB_LOG_ERROR << "Service responded with error";
+            BMCWEB_LOG_ERROR("Service responded with error");
             messages::generalError(asyncResp->res);
         }
         },
@@ -659,11 +658,11 @@
                            const std::string& resName,
                            InsertMediaActionParams& actionParams)
 {
-    BMCWEB_LOG_DEBUG << "Validation started";
+    BMCWEB_LOG_DEBUG("Validation started");
     // required param imageUrl must not be empty
     if (!actionParams.imageUrl)
     {
-        BMCWEB_LOG_ERROR << "Request action parameter Image is empty.";
+        BMCWEB_LOG_ERROR("Request action parameter Image is empty.");
 
         messages::propertyValueFormatError(asyncResp->res, "<empty>", "Image");
 
@@ -673,8 +672,8 @@
     // optional param inserted must be true
     if ((actionParams.inserted != std::nullopt) && !*actionParams.inserted)
     {
-        BMCWEB_LOG_ERROR
-            << "Request action optional parameter Inserted must be true.";
+        BMCWEB_LOG_ERROR(
+            "Request action optional parameter Inserted must be true.");
 
         messages::actionParameterNotSupported(asyncResp->res, "Inserted",
                                               "InsertMedia");
@@ -686,8 +685,8 @@
     if ((actionParams.transferMethod != std::nullopt) &&
         (*actionParams.transferMethod != "Stream"))
     {
-        BMCWEB_LOG_ERROR << "Request action optional parameter "
-                            "TransferMethod must be Stream.";
+        BMCWEB_LOG_ERROR("Request action optional parameter "
+                         "TransferMethod must be Stream.");
 
         messages::actionParameterNotSupported(asyncResp->res, "TransferMethod",
                                               "InsertMedia");
@@ -711,9 +710,9 @@
     // ImageUrl does not contain valid protocol type
     if (*uriTransferProtocolType == TransferProtocol::invalid)
     {
-        BMCWEB_LOG_ERROR << "Request action parameter ImageUrl must "
-                            "contain specified protocol type from list: "
-                            "(smb, https).";
+        BMCWEB_LOG_ERROR("Request action parameter ImageUrl must "
+                         "contain specified protocol type from list: "
+                         "(smb, https).");
 
         messages::resourceAtUriInUnknownFormat(asyncResp->res, *url);
 
@@ -723,9 +722,9 @@
     // transferProtocolType should contain value from list
     if (*paramTransferProtocolType == TransferProtocol::invalid)
     {
-        BMCWEB_LOG_ERROR << "Request action parameter TransferProtocolType "
-                            "must be provided with value from list: "
-                            "(CIFS, HTTPS).";
+        BMCWEB_LOG_ERROR("Request action parameter TransferProtocolType "
+                         "must be provided with value from list: "
+                         "(CIFS, HTTPS).");
 
         messages::propertyValueNotInList(asyncResp->res,
                                          *actionParams.transferProtocolType,
@@ -737,9 +736,9 @@
     if ((uriTransferProtocolType == std::nullopt) &&
         (paramTransferProtocolType == std::nullopt))
     {
-        BMCWEB_LOG_ERROR << "Request action parameter ImageUrl must "
-                            "contain specified protocol type or param "
-                            "TransferProtocolType must be provided.";
+        BMCWEB_LOG_ERROR("Request action parameter ImageUrl must "
+                         "contain specified protocol type or param "
+                         "TransferProtocolType must be provided.");
 
         messages::resourceAtUriInUnknownFormat(asyncResp->res, *url);
 
@@ -753,10 +752,10 @@
         // check if protocol is the same for URI and param
         if (*paramTransferProtocolType != *uriTransferProtocolType)
         {
-            BMCWEB_LOG_ERROR << "Request action parameter "
-                                "TransferProtocolType must  contain the "
-                                "same protocol type as protocol type "
-                                "provided with param imageUrl.";
+            BMCWEB_LOG_ERROR("Request action parameter "
+                             "TransferProtocolType must  contain the "
+                             "same protocol type as protocol type "
+                             "provided with param imageUrl.");
 
             messages::actionParameterValueTypeError(
                 asyncResp->res, *actionParams.transferProtocolType,
@@ -805,7 +804,7 @@
             [asyncResp](const boost::system::error_code& ec) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec;
+                BMCWEB_LOG_ERROR("Bad D-Bus request error: {}", ec);
 
                 messages::internalError(asyncResp->res);
                 return;
@@ -820,7 +819,7 @@
             [asyncResp](const boost::system::error_code& ec) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "Bad D-Bus request error: " << ec;
+                BMCWEB_LOG_ERROR("Bad D-Bus request error: {}", ec);
 
                 messages::internalError(asyncResp->res);
                 return;
@@ -869,14 +868,14 @@
                   const dbus::utility::MapperGetObject& getObjectType) mutable {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " << ec;
+            BMCWEB_LOG_ERROR("ObjectMapper::GetObject call failed: {}", ec);
             messages::resourceNotFound(asyncResp->res, action, resName);
 
             return;
         }
 
         std::string service = getObjectType.begin()->first;
-        BMCWEB_LOG_DEBUG << "GetObjectType: " << service;
+        BMCWEB_LOG_DEBUG("GetObjectType: {}", service);
 
         sdbusplus::message::object_path path(
             "/xyz/openbmc_project/VirtualMedia");
@@ -888,8 +887,8 @@
             if (ec2)
             {
                 // Not possible in proxy mode
-                BMCWEB_LOG_DEBUG << "InsertMedia not "
-                                    "allowed in proxy mode";
+                BMCWEB_LOG_DEBUG("InsertMedia not "
+                                 "allowed in proxy mode");
                 messages::resourceNotFound(asyncResp->res, action, resName);
 
                 return;
@@ -904,7 +903,7 @@
                     return;
                 }
             }
-            BMCWEB_LOG_DEBUG << "Parent item not found";
+            BMCWEB_LOG_DEBUG("Parent item not found");
             messages::resourceNotFound(asyncResp->res, "VirtualMedia", resName);
             });
         });
@@ -935,13 +934,13 @@
                   const dbus::utility::MapperGetObject& getObjectType) {
         if (ec2)
         {
-            BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " << ec2;
+            BMCWEB_LOG_ERROR("ObjectMapper::GetObject call failed: {}", ec2);
             messages::internalError(asyncResp->res);
 
             return;
         }
         std::string service = getObjectType.begin()->first;
-        BMCWEB_LOG_DEBUG << "GetObjectType: " << service;
+        BMCWEB_LOG_DEBUG("GetObjectType: {}", service);
 
         sdbusplus::message::object_path path(
             "/xyz/openbmc_project/VirtualMedia");
@@ -952,7 +951,7 @@
                         const dbus::utility::ManagedObjectType& subtree) {
             if (ec)
             {
-                BMCWEB_LOG_ERROR << "ObjectMapper : No Service found";
+                BMCWEB_LOG_ERROR("ObjectMapper : No Service found");
                 messages::resourceNotFound(asyncResp->res, action, resName);
                 return;
             }
@@ -967,7 +966,7 @@
                     return;
                 }
             }
-            BMCWEB_LOG_DEBUG << "Parent item not found";
+            BMCWEB_LOG_DEBUG("Parent item not found");
             messages::resourceNotFound(asyncResp->res, "VirtualMedia", resName);
             });
         });
@@ -1001,13 +1000,13 @@
                           const dbus::utility::MapperGetObject& getObjectType) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " << ec;
+            BMCWEB_LOG_ERROR("ObjectMapper::GetObject call failed: {}", ec);
             messages::internalError(asyncResp->res);
 
             return;
         }
         std::string service = getObjectType.begin()->first;
-        BMCWEB_LOG_DEBUG << "GetObjectType: " << service;
+        BMCWEB_LOG_DEBUG("GetObjectType: {}", service);
 
         getVmResourceList(asyncResp, service, name);
         });
@@ -1036,13 +1035,13 @@
                   const dbus::utility::MapperGetObject& getObjectType) {
         if (ec)
         {
-            BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: " << ec;
+            BMCWEB_LOG_ERROR("ObjectMapper::GetObject call failed: {}", ec);
             messages::internalError(asyncResp->res);
 
             return;
         }
         std::string service = getObjectType.begin()->first;
-        BMCWEB_LOG_DEBUG << "GetObjectType: " << service;
+        BMCWEB_LOG_DEBUG("GetObjectType: {}", service);
 
         getVmData(asyncResp, service, name, resName);
         });
diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp
index 85aab34..38f10c8 100644
--- a/redfish-core/src/error_messages.cpp
+++ b/redfish-core/src/error_messages.cpp
@@ -51,16 +51,15 @@
         auto messageIdIterator = message.find("MessageId");
         if (messageIdIterator == message.end())
         {
-            BMCWEB_LOG_CRITICAL
-                << "Attempt to add error message without MessageId";
+            BMCWEB_LOG_CRITICAL(
+                "Attempt to add error message without MessageId");
             return;
         }
 
         auto messageFieldIterator = message.find("Message");
         if (messageFieldIterator == message.end())
         {
-            BMCWEB_LOG_CRITICAL
-                << "Attempt to add error message without Message";
+            BMCWEB_LOG_CRITICAL("Attempt to add error message without Message");
             return;
         }
         error["code"] = *messageIdIterator;
@@ -282,9 +281,9 @@
 
 void internalError(crow::Response& res, const std::source_location location)
 {
-    BMCWEB_LOG_CRITICAL << "Internal Error " << location.file_name() << "("
-                        << location.line() << ":" << location.column() << ") `"
-                        << location.function_name() << "`: ";
+    BMCWEB_LOG_CRITICAL("Internal Error {}({}:{}) `{}`: ", location.file_name(),
+                        location.line(), location.column(),
+                        location.function_name());
     res.result(boost::beast::http::status::internal_server_error);
     addMessageToErrorJson(res.jsonValue, internalError());
 }
diff --git a/scripts/replace_logs.py b/scripts/replace_logs.py
new file mode 100755
index 0000000..cc7f87b
--- /dev/null
+++ b/scripts/replace_logs.py
@@ -0,0 +1,100 @@
+#!/usr/bin/python3
+import os
+import re
+from subprocess import check_output
+
+"""
+This script is intended to aid in the replacement of bmcweb log lines from
+BMCWEB_LOG_CRITICAL << "foo" << arg;
+to the new fmt style form
+BMCWEB_LOG_CRITICAL("foo{}", arg);
+
+It is intended to be a 99% correct tool, and in some cases, some amount of
+manual intervention is required once the conversion has been done.  Some
+things it doesn't handle:
+
+ptrs need to be wrapped in logPtr().  This script tries to do the common
+cases, but can't handle every one.
+
+types of boost::ip::tcp::endpoint/address needs .to_string() called on it
+in the args section
+
+arguments that were previously build by in-line operator+ construction of
+strings (for example "foo" + bar), need to be formatted in the arguments
+brace replacement language, (for example "foo{}", bar)
+
+After the script has been run, remember to reformat with clang-format
+
+This script will be removed Q2 2024
+"""
+
+
+SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
+
+files = check_output(
+    ["git", "-C", os.path.join(SCRIPT_DIR, ".."), "grep", "-l", "BMCWEB_LOG_"]
+)
+filenames = files.split(b"\n")
+
+
+for filename in filenames:
+    if not filename:
+        continue
+    with open(filename, "r") as filehandle:
+        contents = filehandle.read()
+
+    # Normalize all the log statements to a single line
+    new_contents = ""
+    replacing = False
+    for line in contents.splitlines():
+        match = re.match(r"\s+BMCWEB_LOG_", line)
+        if match:
+            replacing = True
+
+        if replacing and not match:
+            line = " " + line.lstrip()
+        if line.endswith(";"):
+            replacing = False
+        new_contents += line
+        if not replacing:
+            new_contents += "\n"
+    contents = new_contents
+
+    new_contents = ""
+    for line in contents.splitlines():
+        match = re.match(r"(\s+BMCWEB_LOG_[A-Z]+) <<", line)
+        if match:
+            logstring = ""
+            line = line.lstrip()
+            chevron_split = line.split("<<")
+            arguments = []
+            for log_piece in chevron_split[1:]:
+                if log_piece.endswith(";"):
+                    log_piece = log_piece[:-1]
+                log_piece = log_piece.strip()
+                if (log_piece.startswith('"') and log_piece.endswith('"')) or (
+                    log_piece.startswith("'") and log_piece.endswith("'")
+                ):
+                    logstring += log_piece[1:-1]
+                else:
+                    if log_piece == "this" or log_piece.startswith("&"):
+                        log_piece = "logPtr({})".format(log_piece)
+                    if log_piece == "self":
+                        log_piece = "logPtr(self.get())"
+                    arguments.append(log_piece)
+                    logstring += "{}"
+            if logstring.endswith("\\n"):
+                logstring = logstring[:-2]
+
+            arguments.insert(0, '"' + logstring + '"')
+            argjoin = ", ".join(arguments)
+
+            line = match.group(1) + "(" + argjoin + ");"
+        new_contents += line + "\n"
+
+    contents = new_contents
+
+    with open(filename, "w") as filehandle:
+        filehandle.write(new_contents)
+
+print()
diff --git a/src/boost_asio.cpp b/src/boost_asio.cpp
index 53f2fd6..9e91074 100644
--- a/src/boost_asio.cpp
+++ b/src/boost_asio.cpp
@@ -9,14 +9,14 @@
 {
 void throw_exception(const std::exception& e)
 {
-    BMCWEB_LOG_CRITICAL << "Boost exception thrown " << e.what();
+    BMCWEB_LOG_CRITICAL("Boost exception thrown {}", e.what());
     std::terminate();
 }
 
 void throw_exception(const std::exception& e, const source_location& loc)
 {
-    BMCWEB_LOG_CRITICAL << "Boost exception thrown " << e.what() << " from "
-                        << loc;
+    BMCWEB_LOG_CRITICAL("Boost exception thrown {} from {}:{}", e.what(),
+                        loc.file_name(), loc.line());
     std::terminate();
 }
 } // namespace boost
diff --git a/src/webserver_main.cpp b/src/webserver_main.cpp
index 8150f46..67e2aae 100644
--- a/src/webserver_main.cpp
+++ b/src/webserver_main.cpp
@@ -39,25 +39,25 @@
     int listenFd = sd_listen_fds(0);
     if (1 == listenFd)
     {
-        BMCWEB_LOG_INFO << "attempting systemd socket activation";
+        BMCWEB_LOG_INFO("attempting systemd socket activation");
         if (sd_is_socket_inet(SD_LISTEN_FDS_START, AF_UNSPEC, SOCK_STREAM, 1,
                               0) != 0)
         {
-            BMCWEB_LOG_INFO << "Starting webserver on socket handle "
-                            << SD_LISTEN_FDS_START;
+            BMCWEB_LOG_INFO("Starting webserver on socket handle {}",
+                            SD_LISTEN_FDS_START);
             app.socket(SD_LISTEN_FDS_START);
         }
         else
         {
-            BMCWEB_LOG_INFO
-                << "bad incoming socket, starting webserver on port "
-                << defaultPort;
+            BMCWEB_LOG_INFO(
+                "bad incoming socket, starting webserver on port {}",
+                defaultPort);
             app.port(defaultPort);
         }
     }
     else
     {
-        BMCWEB_LOG_INFO << "Starting webserver on port " << defaultPort;
+        BMCWEB_LOG_INFO("Starting webserver on port {}", defaultPort);
         app.port(defaultPort);
     }
 }
@@ -133,13 +133,13 @@
     int rc = redfish::EventServiceManager::startEventLogMonitor(*io);
     if (rc != 0)
     {
-        BMCWEB_LOG_ERROR << "Redfish event handler setup failed...";
+        BMCWEB_LOG_ERROR("Redfish event handler setup failed...");
         return rc;
     }
 #endif
 
 #ifdef BMCWEB_ENABLE_SSL
-    BMCWEB_LOG_INFO << "Start Hostname Monitor Service...";
+    BMCWEB_LOG_INFO("Start Hostname Monitor Service...");
     crow::hostname_monitor::registerHostnameSignal();
 #endif
 
@@ -161,12 +161,12 @@
     }
     catch (const std::exception& e)
     {
-        BMCWEB_LOG_CRITICAL << "Threw exception to main: " << e.what();
+        BMCWEB_LOG_CRITICAL("Threw exception to main: {}", e.what());
         return -1;
     }
     catch (...)
     {
-        BMCWEB_LOG_CRITICAL << "Threw exception to main";
+        BMCWEB_LOG_CRITICAL("Threw exception to main");
         return -1;
     }
 }
