ConsoleProxy
ConsoleProxy is a sample logging proxy that can transparently replace any console application and log its usage to a file.
Source code:https://github.com/ikriv/ConsoleProxy
Binaries:https://github.com/ikriv/ConsoleProxy/releases
Why it is useful
"As is" it is useful to debug cases when a console proces is invoked from a GUI process behind the scenes: e.g. when git.exe
is invoked from a front end like TortoiseGit or SourceTree. It may also be modified to include additional functionality such as capturing target's output, invoking different versions of the target depending on circumstances, etc.
How to use
To proxy an application named foo.exe
do the following:
- Rename
ConsoleProxy.exe
tofoo.exe
. - If necessary, remove the original
foo.exe
from PATH and add path to the proxied version instead. - Create environment variable
NATIVE_foo
and set its value to the location of the originalfoo.exe
.
When invoked under name foo.exe
, ConsoleProxy creates a log file under %localappdata%\ConsoleProxy\Foo
folder, locates the original foo.exe
via NATIVE_foo
environment variable, and launches it with the same arguments as itself.
For example, suppose the original is located at c:\program files\foo\foo.exe
, and the proxy is c:\temp\ConsoleProxy\foo.exe
. When someone launches
c:\temp\ConsoleProxy\foo.exe -v dostuff
it would invoke the original and create a log file undler %LOCALAPPDATA%\ConsoleProxy\foo
with contents similar to
foo.exe -v dostuff Executing [c:\program files\foo\foo.exe -v dostuff] Exit code 42
Feedback
If you have questions or comments, feel free to
leave feedback.