diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 00835588..e733355c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -161,11 +161,15 @@ jobs: docker logout ghcr.io # Add the user so it has a home directory (needed for the pip cache later on) docker exec --user root unreal useradd -u $uid -g $gid --create-home $user + # Ensure CA certs are in the right directory (needed for running tests) + docker exec --user root unreal bash -c " + mkdir -p /etc/pki/tls/certs ; + cp /etc/ssl/certs/ca-certificates.crt /etc/pki/tls/certs/ca-bundle.crt " # Chown some paths to the GH user to make UE5 work properly. We can't just chown the whole UnrealEngine or # docker would implicitly have to copy it to the container and we would run out of space on the GH runner. docker exec --user root unreal bash -c " chown -R $uid /home/ue4/UnrealEngine/Engine/Binaries/ThirdParty/Mono/Linux ; - chown -R $uid /home/ue4/UnrealEngine/Engine/Programs/UnrealPak/Saved" + chown -R $uid /home/ue4/UnrealEngine/Engine/Programs/UnrealPak/Saved " - name: Setup UE CLI run: docker exec unreal bash -c ' @@ -186,6 +190,10 @@ jobs: - name: Extract package to ${{ matrix.app }}/Plugins run: unzip sentry-unreal-*-engine${{ matrix.unreal }}.zip -d checkout/${{ matrix.app }}/Plugins/sentry + - name: Set permissions for ${{ matrix.app }} + # sentry-native requires write access to sample project directory in order to initialize itself properly + run: docker exec -w /workspace/checkout unreal chmod -R +x ${{ matrix.app }} + - name: Run tests run: docker exec -w /workspace/checkout/${{ matrix.app }} unreal ue4 test --filter Product diff --git a/CHANGELOG.md b/CHANGELOG.md index eb0d453a..570450cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Sentry libs linking for desktop ([#114](https://github.com/getsentry/sentry-unreal/pull/114)) - Fix sentry-cocoa SDK name ([#118](https://github.com/getsentry/sentry-unreal/pull/118)) - Fix scoped event/message capturing on Android ([#116](https://github.com/getsentry/sentry-unreal/pull/116)) +- Fix event capturing on Linux ([#123](https://github.com/getsentry/sentry-unreal/pull/123)) - Fix incomplete type forward declaration ([#125](https://github.com/getsentry/sentry-unreal/pull/125)) ### Dependencies diff --git a/plugin-dev/Source/Sentry/Private/Desktop/SentrySubsystemDesktop.cpp b/plugin-dev/Source/Sentry/Private/Desktop/SentrySubsystemDesktop.cpp index 556494e1..66bf1ab3 100644 --- a/plugin-dev/Source/Sentry/Private/Desktop/SentrySubsystemDesktop.cpp +++ b/plugin-dev/Source/Sentry/Private/Desktop/SentrySubsystemDesktop.cpp @@ -13,12 +13,19 @@ #include "SentryUser.h" #include "SentryModule.h" -#include "Convenience/SentryInclude.h" #include "Infrastructure/SentryConvertorsDesktop.h" #include "CrashReporter/SentryCrashReporter.h" #include "Misc/Paths.h" +void PrintVerboseLog(sentry_level_t level, const char *message, va_list args, void *userdata) +{ + char buffer[512]; + vsnprintf(buffer, 512, message, args); + + UE_LOG(LogSentrySdk, Log, TEXT("%s"), *FString(buffer)); +} + SentrySubsystemDesktop::SentrySubsystemDesktop() { crashReporter = MakeShareable(new SentryCrashReporter); @@ -40,11 +47,19 @@ void SentrySubsystemDesktop::InitWithSettings(const USentrySettings* settings) return; } + const FString DatabasePath = IFileManager::Get().ConvertToAbsolutePathForExternalAppForWrite(*FPaths::Combine(FPaths::ProjectDir(), TEXT(".sentry-native"))); + sentry_options_t* options = sentry_options_new(); sentry_options_set_dsn(options, TCHAR_TO_ANSI(*settings->DsnUrl)); sentry_options_set_release(options, TCHAR_TO_ANSI(*settings->Release)); sentry_options_set_handler_path(options, TCHAR_TO_ANSI(*HandlerPath)); - sentry_init(options); + sentry_options_set_database_path(options, TCHAR_TO_ANSI(*DatabasePath)); + sentry_options_set_logger(options, PrintVerboseLog, nullptr); + sentry_options_set_debug(options, settings->EnableVerboseLogging); + + int initResult = sentry_init(options); + + UE_LOG(LogSentrySdk, Log, TEXT("Sentry initialization completed with result %d (0 on success)."), initResult); crashReporter->SetRelease(settings->Release); } @@ -144,4 +159,4 @@ void SentrySubsystemDesktop::RemoveTag(const FString& key) void SentrySubsystemDesktop::SetLevel(ESentryLevel level) { sentry_set_level(SentryConvertorsDesktop::SentryLevelToNative(level)); -} +} \ No newline at end of file diff --git a/plugin-dev/Source/Sentry/Private/SentrySettings.cpp b/plugin-dev/Source/Sentry/Private/SentrySettings.cpp index 331ef230..15724e60 100644 --- a/plugin-dev/Source/Sentry/Private/SentrySettings.cpp +++ b/plugin-dev/Source/Sentry/Private/SentrySettings.cpp @@ -8,6 +8,7 @@ USentrySettings::USentrySettings(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) , InitAutomatically(false) + , EnableVerboseLogging(true) , UploadSymbolsAutomatically(false) { DsnUrl = TEXT(""); diff --git a/plugin-dev/Source/Sentry/Public/SentrySettings.h b/plugin-dev/Source/Sentry/Public/SentrySettings.h index 34b49cd9..7570bac3 100644 --- a/plugin-dev/Source/Sentry/Public/SentrySettings.h +++ b/plugin-dev/Source/Sentry/Public/SentrySettings.h @@ -54,6 +54,10 @@ class SENTRY_API USentrySettings : public UObject Meta = (DisplayName = "Initialize SDK automatically", ToolTip = "Flag indicating whether to automatically initialize the SDK when the app starts.")) bool InitAutomatically; + UPROPERTY(Config, EditAnywhere, Category = "Misc", + Meta = (DisplayName = "Enable verbose logging", ToolTip = "Flag indicating whether to enable verbose logging on desktop.")) + bool EnableVerboseLogging; + UPROPERTY(Config, EditAnywhere, BlueprintReadWrite, Category = "Misc", Meta = (DisplayName = "Automatically add breadcrumbs")) FAutomaticBreadcrumbs AutomaticBreadcrumbs;