[Feature] Ability to control log location and level.
Describe the feature
Add the ability to control the log level written to the system journal as well as the local log file. Add the ability to disable the local log file (as that info is already written to the system journal).
Currently INFO is written to the system journal and DEBUG is written to a local file.
Use Case
This is causing significant unnecessary disk usage and churn.
In our situation we want all logging written to journald which is then shipped to a central logging point. Managing local log files is not desired. DEBUG logging, when not troubleshooting, is also not desired.
Alternatives considered
I have searched for and been unable to find any settings, env variables, or command line opts that control this.
How important is this for you?
Would improve my workflow
Checklist
- [X] I have searched existing issues and discussions to make sure this hasn't been requested before
Hey @SeeJayEmm — Saturday-evening patrol picked this up. Landed on Testing as commit 25ec54e.
Three env vars now control the log paths at boot, no settings UI required:
PEGAPROX_LOG_LEVEL=INFO # root + app logger level
# accepts DEBUG / INFO / WARNING / ERROR / CRITICAL
# unset → previous default (WARNING in prod, DEBUG w/ --debug)
# --debug still wins over the env var
PEGAPROX_FILE_LOG_LEVEL=INFO # level for the per-cluster logs/<id>.log file
# unset → DEBUG (current behaviour)
PEGAPROX_DISABLE_FILE_LOG=1 # truthy → skip attaching the FileHandler entirely.
# Cluster activity still streams to journald via
# the existing StreamHandler; only the local file
# path is muted. This is the knob you actually want
# for the central-shipping setup.
For a systemd unit:
[Service]
Environment="PEGAPROX_LOG_LEVEL=INFO"
Environment="PEGAPROX_DISABLE_FILE_LOG=1"
Verified the env-var parse handles all the obvious edge cases (set / unset / garbage values fall back to defaults), and the dev instance boots clean with the defaults so nothing changes for anyone who doesn't opt in.
UI toggle in Settings → Logging is a tractable follow-up but not the blocker — you specifically asked for env vars / config-side control because you're a "manage it from the unit file" operator, and that's exactly what landed.
Donations at https://opencollective.com/pegaprox if quality-of-life polish for log-shipping setups earns its keep.
— Marcus
Appreciate you jumping on this. Assuming this change landed in 0.9.10.3 it's only half working. I set the following in my systemd unit:
[Service]
Environment="PEGAPROX_LOG_LEVEL=WARNING"
Environment="PEGAPROX_DISABLE_FILE_LOG=1"
The local log file is no longer being written but INFO level messages are still being sent to journald.
You're right, that was a half-fix. Pushed e30c9ca to Testing (will be in the next release).
Root cause was a logger-propagation thing on our side: each cluster manager carries its own PegaProx_<name> logger with propagate=False and a StreamHandler hardcoded to INFO. So PEGAPROX_LOG_LEVEL=WARNING was correctly setting the root logger level — but the per-cluster StreamHandlers (which produce the bulk of what lands in journald: API polling, balancer, alerts, etc.) weren't seeing it. File handler is gated separately by PEGAPROX_FILE_LOG_LEVEL and PEGAPROX_DISABLE_FILE_LOG, which is why that part worked for you.
After the fix, the per-cluster StreamHandler honours PEGAPROX_LOG_LEVEL too: env-level wins iff it's stricter than INFO. So in your case =WARNING raises the handler floor to WARNING and the noisy INFO lines stop reaching journald. =DEBUG (or unset) keeps the previous INFO default — we don't lower the floor below INFO automatically because that would dump full debug to systemd on a non-debug run.
Verified by replaying the env-var permutations in a small unit:
unset → handler INFO (default)
=DEBUG → handler INFO (env doesn't lower)
=WARNING → handler WARNING ← your case
=ERROR → handler ERROR
Leaving this open until you've confirmed against the next release build.
— Marcus
@SeeJayEmm — v0.9.11 shipped with e30c9ca. PEGAPROX_LOG_LEVEL now caps the per-cluster StreamHandler (the v0.9.10.3 fix only hit the root logger, which is why it looked unchanged). Closing as shipped.
— Marcus
Confirming the fix worked.