Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make log compression optional with JULIA_PKG_SERVER_COMPRESS_LOGS #167

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bin/run_server.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ timestamp_logger(logger) = TransformerLogger(logger) do log
merge(log, (; message = "[$(Dates.format(now(), date_format))] $(log.message)"))
end

compress_logs = get(ENV, "JULIA_PKG_SERVER_COMPRESS_LOGS", "true") in ("True", "TRUE", "true")
sjkelly marked this conversation as resolved.
Show resolved Hide resolved

# Keep 10 days of logs
let fc = NFileCache(log_dir, 10*24, DiscardLRU(); predicate = x -> endswith(x, r"pkgserver\.log(\.gz)?"))
global function postrotate(file)
Expand All @@ -44,7 +46,7 @@ global_logger(TeeLogger(
DatetimeRotatingFileLogger(
log_dir,
string(raw"yyyy-mm-dd-HH-\p\k\g\s\e\r\v\e\r.\l\o\g");
rotation_callback = postrotate,
rotation_callback = compress_logs ? postrotate : identity,
),
Logging.Info,
),
Expand Down