tauri-apps / plugins-workspace

All of the official Tauri plugins in one place!
https://tauri.app
Apache License 2.0
858 stars 241 forks source link

[log] Default log path for linux and windows seems unconventional #1

Closed ozgunozerk closed 5 months ago

ozgunozerk commented 2 years ago

I believe the convention for storing the log files on Linux is, using the path /var/log. Is there a specific reason for choosing .config instead? (https://github.com/tauri-apps/tauri-plugin-log/blob/dev/src/lib.rs#L106)

JonasKruckenberg commented 2 years ago

Referencing the original PR: https://github.com/tauri-apps/tauri/pull/2736 this was done to mirror the behavior of electrons setAppLogsPath function.

The reason for this is that most packaging formats (snap, appimage, flatpack) reserve an Application Directory for you, that in many cases is the only folder that is writable by default. ${configDir}/${bundleIdentifier} (despite the misleading name of configDir) happens to resolve to exactly that folder ($XDG_CONFIG_HOME or $HOME/.config is you were wondering).

So this really boils down to sandbox restrictions and we don't want peoples logging to fail because of missing sanbox privileges.

If you never plan on distributing snap, appimage or flatpack formats and only ever ship deb packages, or you manually request the necessary sandbox privilegess than you can use LogTarget::Dir("/var/log".into()) without a problem.

FabianLars commented 2 years ago

While following setAppLogsPath is fine by me, i too feel like the config dir is "wrong", on linux and windows btw. That said i don't like /var/log/ for desktop apps at all and the alternative seems to be ~.local/share/ and AppData\Local (instead of AppData\Roaming -> data_local_dir()

On the other hand i'm not a fan of splitting up app files into multiple dirs, but that's just personal preference i guess.

nazar-pc commented 2 years ago

On Linux either ~/.local/share or even .cache would be more canonical. /var/log is not for regular GUI apps as it is not writable for most users.

Can someone link to upstream info/issues on sandboxing? If they don't support something as simple as proper place for logs instead of config directory, then we should create corresponding tickets for them to add such support.

FabianLars commented 1 year ago

/upstream tauri-apps/tauri