Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
285 views
in Technique[技术] by (71.8m points)

logging - C# debug log console app

I am trying to create a console window for debugging in C#.

For example, consider the following scenario:

I have a forms app and I want to log events to a console window in real time.
When an event is triggered the forms app should send data to be printed to the console app so that I can see when the event is triggered and data about the specific event.
When I input a specific command in the console app, it sends the command to the forms app and triggers the event.

Because it is for debugging, the console should be a separate app so that if the main app dies, the console window won't.

If I do this right I assume I should be able to get the console app working with programs such as Console2/Conemu.

Does anyone know the correct technique to achieve this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Thee ways, I think, depending how do you want to initialize communication between your processes. I believe, named pipes - is the best choice. But as you wish...

1) You may "create" your console with following command

ConEmuC.exe /ATTACH /ROOT "<Full path to your consolepart.exe>" <Arguments console part>
or
ConEmu.exe /cmd "<Full path to your consolepart.exe>" <Arguments console part>

2) "Attach" created console from normally started console part application. Read here. The idea is to run following command in the free, just created console.

ConEmuC.exe /AUTOATTACH

3) At last, you may try "Default Terminal" feature. Described here.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...