Skip to content

Commit

Permalink
Ensure project-manager's logs are centrally collected
Browse files Browse the repository at this point in the history
Minor fix to bring back project-manager's logs.

Previous, default, configuration meant that logs for project-manager
ended up in a separate file from the rest of the logs.
Language server logs are being sent to the logging server by default,
so should project-manager's ones as well.

Fixed NPE in `SocketLoggingNode` when no `project.id` is present in
loggers, as is the case with logs coming from project-manager.
  • Loading branch information
hubertp committed Feb 25, 2025
1 parent e002d94 commit 95923ed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ public void run() {
event = (ILoggingEvent) hardenedLoggingEventInputStream.readObject();
if (projectId == null) {
try {
projectId = UUID.fromString(event.getMDCPropertyMap().get("project.id"));
var property = event.getMDCPropertyMap().get("project.id");
if (property != null) {
projectId = UUID.fromString(property);
}
} catch (IllegalArgumentException e) {
// ignore
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ logLevel, actualPort, logPath(), logFileSuffix(), config.getServer(), ec)
if (result.isFailure()) {
setup(Option.apply(logLevel), Option.empty(), logMasking, loggerSetup);
} else {
URI uri = result.get();
Masking.setup(logMasking);
if (!loggerSetup.setup(logLevel)) {
LoggingServiceManager.teardown();
loggingServiceEndpointPromise.failure(new LoggerInitializationFailed());
} else {
URI uri = result.get();
loggingServiceEndpointPromise.success(Option.apply(uri));
}
}
Expand Down
6 changes: 3 additions & 3 deletions lib/scala/project-manager/src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ logging-service {
name = "file"
}
]
default-appender = file
default-appender = socket
default-appender = ${?ENSO_APPENDER_DEFAULT}
log-to-file {
enable = true
Expand All @@ -55,9 +55,9 @@ logging-service {
port = ${?ENSO_LOGSERVER_PORT}
log-to-file {
enable = true
enable = ${?ENSO_LOG_TO_FILE}
enable = ${?ENSO_LOGSERVER_LOG_TO_FILE}
log-level = debug
log-level = ${?ENSO_LOG_TO_FILE_LOG_LEVEL}
log-level = ${?ENSO_LOGSERVER_LOG_TO_FILE_LOG_LEVEL}
}
appenders = [ # file/console/socket/sentry
{
Expand Down

0 comments on commit 95923ed

Please sign in to comment.