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

clink.log is not deleted when Cmder injects Clink #80

Closed
mariograz opened this issue Mar 5, 2021 · 9 comments
Closed

clink.log is not deleted when Cmder injects Clink #80

mariograz opened this issue Mar 5, 2021 · 9 comments
Labels
bug Something isn't working

Comments

@mariograz
Copy link

I know there is a --nolog arguement, is it possible to add a "log=0" in the settings file to disable logging?

@chrisant996
Copy link
Owner

It might be.

Can you describe the motivation behind the request?

What problem is caused by logging, that makes it desirable to permanently disable logging?

@chrisant996 chrisant996 added the needs more information The issue needs clarifying information label Mar 6, 2021
@chrisant996
Copy link
Owner

@mariograz Can you describe the motivation behind the request? What problem is caused by logging?

@mariograz
Copy link
Author

Sorry It took so long to get back to you, I was unexpectedly away.

I use cmder, and they've recently integrated this clink fork. I don't have a need for logging especially since things are working great.

While the current log file doesn't seem to grow large all that fast, it's just another log file that will need to be managed.

I think it makes more sense to make logging disabled by default, and if its needed it can be turned on.

As a work around, I tried to use the --nolog argument, but I'm unable to grok where cmder calls clink.

I'm also not looking to make a bunch of work for anyone.

@chrisant996
Copy link
Owner

The log gets deleted and recreated -- its growth is not unbounded. It doesn't seem to need to be "managed".

I much prefer it to be on always, so that when there's a problem, I can simply say "run clink info to find the log file and attach it". I have to think about the cost to me, for supporting Clink, and having logging always enabled reduces my personal cost of maintaining Clink.

@mariograz
Copy link
Author

My log file doesn't seem to be deleted & recreated when I close the shell. It seems to grows about 10-20k every time I execute cmder. Is there a different interval that I should expect it to be refreshed?

This might not be your issue, it could just be a cmder issue.

I agree with you to have it always on, that definitely would help with support requests.

@chrisant996
Copy link
Owner

chrisant996 commented Mar 11, 2021

clink inject tries to delete the log file each time. So that if no other Clink instances are running, the log gets deleted/created anew. If any Clink instances are already using the log file, then deletion will fail.
(Edit: I misspoke -- it always deletes the log file on every inject, even if another Clink is using it.)

Could it be that there is another Clink instance running? If you reboot the computer and start a new Clink session, does that start the log file over fresh?

@mariograz
Copy link
Author

I've restarted the PC & then deleted the existing log file (clink.log). then I ran cmder twice, closing it fully between runs and making sure there were no cmd or clink instances in the process window.

It does not look like the file was deleted, or attempted to be deleted between executions.
I've attached the log file here-
clink.log

@mariograz
Copy link
Author

mariograz commented Mar 11, 2021

Ok- So I might have wasted your time somewhat. I used procmon.exe to see what was happening, and I noticed that when clink.exe tried to access clink.log the API result was REPARSE.
That reminded me that I keep the cmder configuration directory (Which contains the clink.log file) in a hardlinked location. I believe this is causing *odd behavior with the logfile recreation api call.

image

I'm sorry about that.

@chrisant996
Copy link
Owner

Aha! It isn't the hardlink.

Cmder overrides the default Clink profile directory.
clink inject builds an application context to inject into cmd.exe, using the overridden profile directory.
However, when clink inject deletes the clink.log file, it uses its own application context by mistake -- it should have used the injected application context for that particular operation.

Thanks for discovering and reporting this!

@chrisant996 chrisant996 changed the title [Feature Request] Add setting to disable log in settings file clink.log is not deleted when Cmder injects Clink Mar 11, 2021
@chrisant996 chrisant996 added bug Something isn't working and removed needs more information The issue needs clarifying information labels Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants