-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
[feat] Custom logging location #4466
Comments
What difficulties are there with copying the log to the desired location prior to creating the artifact? |
Does the RFC process require proving difficulty, or mere inconvenience and improvement? Nothing is difficult or impossible with an open operating system. |
I don't know about a requirement, but any addition to anything should be weighed against the alternatives without it. In other words, every convenience/improvement for one group is an inconvenience/detriment for another, so subjective decisions always need to be made. If the delta between: npm foo --log=$logdir/$filename bar
# or
NPM_CONFIG_LOG=$logdir/$filenamenpm foo bar and npm foo bar
cp $HOME/.npm/_logs $logdir doesn't feel like it outweighs the downside of the added complexity to npm, then that would be a very important consideration for the RFC. |
If we have multiple npm commands running at the same time, being able to specify a custom log location for each one individually would help ensure that we know which log goes with which command. |
I would be in favor of this. I would use it in the cases described above but also when debugging as I often do Some questions I have about expected behavior @EvanCarroll:
const dir = path.dirname(logfile)
mkdirpInferOwner.sync(dir)
fs.openSync(logfile, 'a')
const st = fs.lstatSync(dir)
fs.chownSync(dir, st.uid, st.gid)
fs.chownSync(file, st.uid, st.gid) If supplying your own logdir, would you expect anything like that to happen? Or to error if |
I agree with this use case being another beneficial reason to add this option, but I don't think the filename should be made configurable, only the directory. |
I have no strong preference on this as ultimately I'm just logging for the CI run. However I would treat them the same only so in the future this may be totally configurable in some future
I would not chown things I didn't create. I would error if I couldn't access them or if I had reason to believe they were egregiously misconfigured or otherwise likely to cause a security problem (this is what SSH does if you chmod your private key improperly |
Thanks @EvanCarroll, I agree with both those points. I can make an actual RFC for this based on the current discussion if it gets accepted, but I'm a +1 on it. To summarize the current implementation being discussed:
|
This ended up not needing an explicit RFC so I transferred to the cli repo as an enhancement |
Before Opening Please...
There is one RFC about logging: using STDERR for errors instead of STDOUT. This is unrelated.
Motivation ("The Why")
Currently some CI providers, specifically GitLab, restrict job artifacts to being relative to the repository. Presumably, this stops you from uploading runner files that may have dirty-state left from previous runs in non-containerized workflows. Specifically the GitLab documents say,
This effectively means NPM logs on error can not be captured as job artifacts.
Example
How
Current Behaviour
What I would like to do is something like this (ignore the actual error)
Then I want to upload
/root/.npm/_logs/2021-11-22T17_24_50_085Z-debug.log
as a job artifact.This is not currently possible
Desired Behaviour
In light of GitLab not permitting global files to be uploaded as job artifacts I would like an option to set the log file,
Such that
LOCATION
could be relative to the cwd.Then I could do,
And set
./.npm/_logs/*
as my artifacts to upload to GitLab.References
The text was updated successfully, but these errors were encountered: