diff --git a/src/app/clipboardclient.cpp b/src/app/clipboardclient.cpp
index 769a2ae2df116e7707a25b5d59a7687e13002aef..d14fb9d27a1731a69066cddbda7f502fe7dfcaff 100644
--- a/src/app/clipboardclient.cpp
+++ b/src/app/clipboardclient.cpp
@@ -62,12 +62,12 @@ QCoreApplication *createClientApplication(int &argc, char **argv, const QStringL
         QGuiApplication::setDesktopSettingsAware(false);
         const auto app = platformNativeInterface()
                 ->createClipboardProviderApplication(argc, argv);
-        setCurrentThreadName(arguments[1]);
+        setLogLabel(arguments[1].toUtf8());
         return app;
     }
 
     const auto app = platformNativeInterface()->createClientApplication(argc, argv);
-    setCurrentThreadName("Client");
+    setLogLabel("Client");
     return app;
 }
 
diff --git a/src/app/clipboardserver.cpp b/src/app/clipboardserver.cpp
index 86c5efcdd2e0be001f35ef0b80b5f2d125cc038b..77207bdec4d5770a2b1baf724a1f58785621a823 100644
--- a/src/app/clipboardserver.cpp
+++ b/src/app/clipboardserver.cpp
@@ -96,7 +96,7 @@ ClipboardServer::ClipboardServer(QApplication *app, const QString &sessionName)
     , m_shortcutActions()
     , m_ignoreKeysTimer()
 {
-    setCurrentThreadName("Server");
+    setLogLabel("Server");
 
     const QString serverName = clipboardServerName();
     m_server = new Server(serverName, this);
diff --git a/src/common/common.cpp b/src/common/common.cpp
index 30727bb6a66179a6b73be8e4cb2966a90c91f834..e7a598c38f8db9ddc64e9c71e0cf7ed2906d2d54 100644
--- a/src/common/common.cpp
+++ b/src/common/common.cpp
@@ -696,7 +696,7 @@ QByteArray makeClipboardOwnerData()
 {
     static int id = 0;
     return qgetenv("COPYQ_SESSION_NAME")
-           + " " + currentThreadLabel()
+           + " " + logLabel()
            + "/" + QByteArray::number(++id);
 }
 
diff --git a/src/common/log.cpp b/src/common/log.cpp
index b3d8a6a46dcb55316227dde1d60b9e0c3bc5fd78..88959f089fcb82088e0f4714654b8e36858a31cf 100644
--- a/src/common/log.cpp
+++ b/src/common/log.cpp
@@ -25,7 +25,6 @@
 #include <QFile>
 #include <QString>
 #include <QSystemSemaphore>
-#include <QThread>
 #include <QtGlobal>
 #include <QVariant>
 
@@ -35,12 +34,6 @@
 #include <cmath>
 #include <memory>
 
-#ifdef Q_OS_MAC
-#   define THREAD_LOCAL __thread
-#else
-#   define THREAD_LOCAL thread_local
-#endif
-
 /// System-wide mutex
 class SystemMutex final {
 public:
@@ -82,11 +75,6 @@ Q_DECLARE_METATYPE(SystemMutexPtr)
 
 namespace {
 
-// Avoid heap allocation for thread local variable.
-constexpr int maxThreadLabelSize = 48;
-THREAD_LOCAL char currentThreadLabel_[maxThreadLabelSize] = "";
-
-
 const int logFileSize = 512 * 1024;
 const int logFileCount = 10;
 
@@ -268,7 +256,7 @@ QByteArray createLogMessage(const QByteArray &text, const LogLevel level)
 {
     const auto timeStamp =
             QDateTime::currentDateTime().toString(" [yyyy-MM-dd hh:mm:ss.zzz] ").toUtf8();
-    const auto label = "CopyQ " + logLevelLabel(level) + timeStamp + currentThreadLabel() + ": ";
+    const auto label = "CopyQ " + logLevelLabel(level) + timeStamp + logLabel() + ": ";
     return createLogMessage(label, text);
 }
 
@@ -364,17 +352,14 @@ void log(const QString &text, const LogLevel level)
     }
 }
 
-void setCurrentThreadName(const QString &name)
+void setLogLabel(const QByteArray &name)
 {
-    Q_ASSERT(qApp != nullptr);
-
     const auto id = QCoreApplication::applicationPid();
-    const auto threadLabel = "<" + name.toUtf8() + "-" + QByteArray::number(id) + ">";
-    const auto size = std::min( maxThreadLabelSize, threadLabel.size() );
-    std::memcpy( currentThreadLabel_, threadLabel.constData(), static_cast<size_t>(size) );
+    logLabel() = "<" + name + "-" + QByteArray::number(id) + ">";
 }
 
-QByteArray currentThreadLabel()
+QByteArray &logLabel()
 {
-    return QByteArray(currentThreadLabel_);
+    static QByteArray label;
+    return label;
 }
diff --git a/src/common/log.h b/src/common/log.h
index 4108c98acbdd9a231dee1f5723d7bd98d1543a97..c97c21f20da72fc65cf2172a63b01c25a365be29 100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -49,8 +49,8 @@ QByteArray logLevelLabel(LogLevel level);
 
 void log(const QString &text, LogLevel level = LogNote);
 
-void setCurrentThreadName(const QString &name);
+void setLogLabel(const QByteArray &name);
 
-QByteArray currentThreadLabel();
+QByteArray &logLabel();
 
 #endif // LOG_H
diff --git a/src/main.cpp b/src/main.cpp
index 5ab2948475f790a0165e69e1e87fa51b5fc77e28..c0bdd9a6cb903e49659cc55da6260bf172103d48 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -52,7 +52,7 @@ int evaluate(
         const QString &sessionName)
 {
     App app( platformNativeInterface()->createConsoleApplication(argc, argv), sessionName );
-    setCurrentThreadName("Prompt");
+    setLogLabel("Prompt");
 
     QScriptEngine engine;
     Scriptable scriptable(&engine, nullptr);