CobaltFusion / DebugViewPP

DebugView++, collects, views, filters your application logs, and highlights information that is important to you!
Boost Software License 1.0
1k stars 143 forks source link

Get Output in Java #103

Closed Jerry0022 closed 10 years ago

Jerry0022 commented 10 years ago

Hi, is it possible that I catch the output in Java which your program is generating (in real-time). Maybe via TCP or UDP? Is there a chance to do this without much effort? Is there sth. implemented in your program and, if yes, how can I use it?

janwilmans commented 10 years ago

I'm not sure what you are trying to do, could you please describe your use-case, you what win32 message in java? but why? what is the purpose? Isn't java debug output usually logged through logging libs like log4j ?

If you could explain how you would like to use debugviewpp, we can see you we can support it.

However, the original debugview (http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx) has commandline options to have it behave as a server, see dbgview.exe /?

I've not sure how to exactly connect to it, maybe the help-file describes it...


DebugView

You can direct DebugView to run as an agent that sends output to a viewer running on another computer with the following command-line syntax:

Agent usage: dbgview [/a [/t] [/s] [/g] [/e] [/k] [/v]]

/a Start in agent mode /t Start minimized in the tray /g Capture global Win32 output /s Agent silent mode - no window is displayed /e Agent notifies you when connection to server is broken /k Capture kernel output /v Enable verbose kernel output

The following command-line syntax starts DebugView in viewer mode:

Viewer usage: dbgview [/t] [/f] [/k[n]] [/o[m|n]] [/v[n]] [/l Logfile [/a] [[/m nnn [/w]] ] | [/n [/x]]] [/h nnn] [LogFile]

/t Start minimized in the tray /f No filter prompt /o Use clock time (/o), clock time with ms (/om), or elapsed time (/on) /l Log output to the specified file /g Enable global Win32 capture (/g) or disable global Win32 capture (/gn) /k Enable kernel capture (/k) or disable kernel capture (/kn) /m Limit log file to size (in MB) /p Append output to log file if it exists /w Wrap to the start when the log file reaches max /n Create a new log file every day /x Clear display on new log file /h Set history depth to specified size /v Enable verbose kernel capture with /v and disable with /vn (XP and higher) Specify a log file to load it.

janwilmans commented 10 years ago

http://outputdebugstring.wordpress.com/2010/02/26/the-outputdebugstring/

Jerry0022 commented 10 years ago

Thank you for the fast answers. To sum up I like to do it the other way around. My Java program likes to know the output of another program (completely independent). Maybe it is better if I explain more my specific case:

I have a Logitech G19s keyboard, which has a display and it is possible via a C API of Logitech (wrapped in Java from another guy) to program LCD applets with Java. I created also one. Furthermore there are special keys and functions (for example profiles controlled via the LCD display), currently I've the focus on the mode keys. For some LCD display features there is a C API which works very well (to program an applet) but doesn't give me an indication of pressing the special keys (for example to notice if the mode changes by pressing the mode key(s)). But there is also another possibility (with other functions) in the Logitech Game Panel to program in LUA. So I can directly write: If sth. happens with the special keys it should do sth. with LUA. BUT this environment doesn't support the typical LUA functions, it just supports a handful functions from Logitech. The only possibility to give this real-time event (mode key pressed) to outside of the Logitech environment is a function called OutputDebugMessage (which includes the event description, which key and which action). HERE is the critical point. I have the OutputDebugMessage flying around in the Windows environment and a Java Applet (which like to know in real-time this event message). I searched in the internet several times, but in the end I found only debugView (which you mentioned) and your project which can catch this OutputDebugMessage in real-time. Now I have your GUI and my Java Applet. How can they communicate? => In conclusion: I want to get the debug message of another program, in my case, the Logitech Game Panel (which works with your program and the debugView.exe)... => Maybe my Applet and your application (running in silent mode???) can communicate so that I get in the end the "mode key pressed" event in real-time :D // By the way, filter your output by identifying and comparing the PID of the Logitech Game Panel and parse the content to get the real event is my plan to get the information (the spefic event) out of the output of your program.

Or if TCP or UDP is not needed can you explain me the way how to reach this goal?

janwilmans commented 10 years ago

If I understand correctly, the applet runs on the keyboard, right? I guess the messages on OutputDebugString are only for debugging, not intended to be received by the applet. Re-routing outputdebugstring messages to use for an application sounds like a really bad idea. Maybe http://www.logitech.com/en-us/support/g19-keyboard-for-gaming?crid=411 can help you further.

Jerry0022 commented 10 years ago

Yes I know, it is not the best idea. I read the whole Logitech documentation, the C SDK, the LUA API etc. etc. But this is the only way to get the events in real time to know that for example the mode key was pressed. I didn't find a solution anywhere in the internet. I would prefer a better solution but nobody and nothing can help me except your program which provides the needed information (just in a bad way for my purposes :D ). If I would see another possible, more convenient solution, I would choose it. But Logitech offers just this one method. The only one to transport these information to outside... // By the way, there aren't just special key pressed events but the profile changes too (which are controlled by the LCD display).

janwilmans commented 10 years ago

Lets take this outside of this issue, please email me at janwilmans at gmail.com

janwilmans commented 10 years ago

As discussed, I have added a commandline tool DebugViewCmd.exe that outputs all messages on the commandline in the format: <processID><tab><processname><tab><message><newline>