Comments (9)
Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.
from watchman.
This is doable in most common cases; if we were passed a log file name argument, then we can periodically check the size and rotate.
from watchman.
I am interested to work on this feature. @wez Could you please suggest me from where should I start? I've built _watchman_ on my machine.
from watchman.
@qmaruf yep, the high level idea is that we'd want to rotate the log file. This is typically implemented in one of two ways:
- External software that manages log files can rename the current log file to a new name, then send some kind of signal to the service to tell it to re-open its log file
- Modify the service itself so that it has some kind of rotation policy.
We can support both of these things. The high level plan is:
- Add a function that can reopen the log file. This is logically as simple as closing the old log file handle and then opening the configured log file again. The existing code for opening the log file is towards the top of main.c; it should be moved into log.c. Care should be taken to ensure that we don't lose log events while making this switch.
- Add a watchman command that will trigger the log file to be re-opened. This will facilitate controlling log file rotation via software like
logrotate
; it would just runwatchman log-reopen
- Add a configuration option that specifies:
- how often to check the log file size in seconds
- the maximum size
- If size checking is enabled (the checking interval is non-zero), every interval seconds, compare the size. If the size is larger than desired, rename the log file by appending the current unix timestamp to the log file name and then reopen the log file.
I consider the following things to be non-goals for watchman; our focus is on answering questions about the filesystem rather than re-implementing features that exist in other widely deployed software:
- Configuring an alternative or more flexible way of naming the moved log files
- Limiting the number of re-opened log files (I'm on the fence about this, but am leaning towards saying that the user can script cleaning this up for themselves, outside of watchman. Other software exists with the sole purpose of performing this kind of cleanup)
from watchman.
Is there any way to print something in console using _printf()_ while watchman is running, for debugging purpose? I am using _watchman --server-encoding=json --persistent log-level debug_, but it only prints log info. I need to understand the sequence of execution.
from watchman.
you can use w_log(W_LOG_ERR, "format %s\n", "foo")
to log to the log file at ERR
level.
You can run: watchman --foreground --logfile=/dev/stdout
to run in the foreground and have the log file go to your terminal. You can use the -v
option to change the default log level.
from watchman.
@wez What does watchman do after w_event_set()
? AFAIU, w_event_set()
is called after enqueuing log message in client
queue. I am looking for the code where client
is dequeued and log message is written to file.
from watchman.
I'm not sure I understand your question. The client responses are de-queued dispatched here: https://github.com/facebook/watchman/blob/master/listener.c#L495 but that is completely unrelated to the log file related functions that are in log.c
from watchman.
I thought message is being written to log file after dequeuing from client
. I planned to check log size before writing to it so that we could avoid checking its size continuously whenever we don't need to .
from watchman.
Related Issues (20)
- Homebrew install watchman failed HOT 4
- watchman on riscv
- why watchman does not support query base on time frame and sorting ability?
- Impossible to install on Amazonlinux HOT 2
- Folly related build issue for ARM Ubuntu 18.04.5 LTS
- Missing RPMs in Release v2023.04.24.00
- WatchMan Error on Docker. Watchman-make is not accessible even after installation.
- "Settle" behavior blocks entire file tree during long running zip operation
- Unable to compile with fmt 10.0.0
- Unable to talk to your watchman on /opt/homebrew/var/run/watchman/[user]-state/sock! HOT 8
- serde_bser: Apache-2.0 license file missing from git repo and published crates
- No Mac OS X binary
- Watchman ignores platform-specific path separators in `dirname` expressions
- Watchman root is set to /Users/<username> despite being run from a different directory HOT 1
- Ubuntu packags missing since May HOT 3
- "I don't know how to install any packages on this system linux-mint-21.2"
- Watchman warns on custom_config example line
- Installation guide HOT 2
- Question - `hint_num_files_per_dir` recursive or not?
- Watchman service is timing out waiting for a synchronization cookie file to be observed by the watcher within 20000 milliseconds HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from watchman.