aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/zenserver.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-09-22 10:04:02 -0400
committerGitHub <[email protected]>2023-09-22 16:04:02 +0200
commit47ba787e2cfe32b252b74e09494fbcaabc4e8190 (patch)
tree80acc5dfa51b08211583e38d31be2b2327a525a3 /src/zenserver/zenserver.cpp
parentadded support for sln on Mac (#421) (diff)
downloadzen-47ba787e2cfe32b252b74e09494fbcaabc4e8190.tar.xz
zen-47ba787e2cfe32b252b74e09494fbcaabc4e8190.zip
Add runtime status/control of logging (#419)
- Feature: New endpoint `/admin/logs` to query status of logging and log file locations and cache logging - `enablewritelog`=`true`/`false` parameter to control cache write logging - `enableaccesslog`=`true`/`false` parameter to control cache access logging - `loglevel` = `trace`/`debug`/`info`/`warning`/`error` - Feature: New zen command `logs` to query/control zen logging - No arguments gives status of logging and paths to log files - `--cache-write-log` `enable`/`disable` to control cache write logging - `--cache-access-log` `enable`/`disable` to control cache access logging - `--loglevel` `trace`/`debug`/`info`/`warning`/`error` to set debug level
Diffstat (limited to 'src/zenserver/zenserver.cpp')
-rw-r--r--src/zenserver/zenserver.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/zenserver/zenserver.cpp b/src/zenserver/zenserver.cpp
index 9c607f1d3..c36e20b30 100644
--- a/src/zenserver/zenserver.cpp
+++ b/src/zenserver/zenserver.cpp
@@ -433,7 +433,13 @@ public:
m_GcScheduler.Initialize(GcConfig);
// Create and register admin interface last to make sure all is properly initialized
- m_AdminService = std::make_unique<HttpAdminService>(m_GcScheduler, *m_JobQueue);
+ m_AdminService =
+ std::make_unique<HttpAdminService>(m_GcScheduler,
+ *m_JobQueue,
+ *m_CacheStore,
+ HttpAdminService::LogPaths{.AbsLogPath = ServerOptions.AbsLogFile,
+ .HttpLogPath = ServerOptions.DataDir / "logs" / "http.log",
+ .CacheLogPath = ServerOptions.DataDir / "logs" / "z$.log"});
m_Http->RegisterService(*m_AdminService);
return EffectiveBasePort;
@@ -905,12 +911,13 @@ ZenServer::InitializeStructuredCache(const ZenServerOptions& ServerOptions)
using namespace std::literals;
ZEN_INFO("instantiating structured cache service");
- m_CacheStore = new ZenCacheStore(m_GcManager,
- ZenCacheStore::Configuration{.BasePath = m_DataRoot / "cache",
- .AllowAutomaticCreationOfNamespaces = true,
- .EnableWriteLog = ServerOptions.StructuredCacheWriteLogEnabled,
- .EnableAccessLog = ServerOptions.StructuredCacheAccessLogEnabled},
- m_GcManager.GetDiskWriteBlocker());
+ m_CacheStore =
+ new ZenCacheStore(m_GcManager,
+ ZenCacheStore::Configuration{.BasePath = m_DataRoot / "cache",
+ .AllowAutomaticCreationOfNamespaces = true,
+ .Logging = {.EnableWriteLog = ServerOptions.StructuredCacheWriteLogEnabled,
+ .EnableAccessLog = ServerOptions.StructuredCacheAccessLogEnabled}},
+ m_GcManager.GetDiskWriteBlocker());
const ZenUpstreamCacheConfig& UpstreamConfig = ServerOptions.UpstreamCacheConfig;
@@ -1136,7 +1143,7 @@ ZenEntryPoint::Run()
sentry_options_set_dsn(SentryOptions, "https://[email protected]/5919284");
sentry_options_set_database_path(SentryOptions, SentryDatabasePath.c_str());
sentry_options_set_logger(SentryOptions, SentryLogFunction, this);
- std::string SentryAttachmentPath = m_ServerOptions.AbsLogFile.string();
+ std::string SentryAttachmentPath = PathToUtf8(m_ServerOptions.AbsLogFile);
if (SentryAttachmentPath.starts_with("\\\\?\\"))
{
SentryAttachmentPath = SentryAttachmentPath.substr(4);