Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7124772
D4265.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D4265.diff
View Options
diff --git a/swh/fuse/cli.py b/swh/fuse/cli.py
--- a/swh/fuse/cli.py
+++ b/swh/fuse/cli.py
@@ -5,6 +5,7 @@
import asyncio
from contextlib import ExitStack
+import logging
import os
# WARNING: do not import unnecessary things here to keep cli startup time under
@@ -106,9 +107,28 @@
from swh.fuse import fuse
+ # TODO: set default logging settings when --log-config is not passed
+ # DEFAULT_LOG_PATH = Path(".local/swh/fuse/mount.log")
with ExitStack() as stack:
if not foreground:
+ # TODO: temporary fix until swh.core has the proper logging utilities
+ # Disable logging config before daemonizing, and reset it once
+ # daemonized to be sure to not close file handlers
+ logging.shutdown()
# Stay in the current working directory when spawning daemon
cwd = os.getcwd()
stack.enter_context(DaemonContext(working_directory=cwd))
+ logging.config.dictConfig(
+ {
+ "version": 1,
+ "handlers": {
+ "syslog": {
+ "class": "logging.handlers.SysLogHandler",
+ "address": "/dev/log",
+ },
+ },
+ "root": {"level": ctx.obj["log_level"], "handlers": ["syslog"],},
+ }
+ )
+
asyncio.run(fuse.main(swhids, path, ctx.obj["config"]))
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Dec 21 2024, 6:52 PM (11 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3216829
Attached To
D4265: cli: redirect logging to user syslog when daemonized
Event Timeline
Log In to Comment