Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Suppress JInput output or redirect to a file  (Read 2481 times)
0 Members and 1 Guest are viewing this topic.
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Posted 2005-08-18 14:54:23 »

hi

Is it possible to suppress the JInput output (to stdout) or catch it (and parse it) and/or redirect to a file?

Qudus
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #1 - Posted 2005-08-18 19:37:37 »

Hi

I had an awful number of problems reported that with no output were impossible to diagnose, so by default, all the output is there. There is also the plugins system that outputs a bunch of debug. For now, the output is on.

Endolf

Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #2 - Posted 2005-08-18 21:22:57 »

Galun just told me how to redirect stdout and stderr:

        OutputStream osc1 = new OutputStreamXYZ();
        PrintStream newStdout = new PrintStream(osc1);
        OutputStream osc2 = new OutputStreamXYZ();
        PrintStream newStderr = new PrintStream(osc2);
        System.setOut(newStdout);
        System.setErr(newStderr);

This is great. So I can stop the annoying xith output waisting my own logging. Or I can just filter the output byte wise.

But jinput doesn't seem to use the jeva stdout or stderr. So I cannot force it to give its output to me instead of stdout or stderr. Is this correct or is there an output channel I don't know of in java?

Qudus

Edit: I watched it a little closer. The following output comes just after the program terminated:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
Initing event interface
Device name for device file /dev/input/event0 is AT Translated Set 2 keyboard
Device name for device file /dev/input/event1 is Logitech USB-PS/2 Optical Mouse
Copied temp event device 0 to event device 0
Copied temp event device 1 to event device 1
Initing joystick interface
Getting the number of event devices
Getting 2 event devices
Getting the number of joystick devices
Getting 0 joystick devices
Gettign device name for jinput device 0.
jinput device 0 is 136319456
EventDevice::getName()
Gettign device name for jinput device 0, (AT Translated Set 2 keyboard)
EventDevice::getName()
Gettign number of absolute axes for jinput device 0 (0)
Gettign number of relative axes for jinput device 0 (0)
Gettign number of buttons for jinput device 0 (146)
Getting bus type for device 0
Getting supported buttons for jinput device 0
Getting suported relative axes for jinput device 0
Getting suported absolute axes for jinput device 0
Getting supported buttons for jinput device 0
Gettign device name for jinput device 1.
jinput device 1 is 136321968
EventDevice::getName()
Gettign device name for jinput device 1, (Logitech USB-PS/2 Optical Mouse)
EventDevice::getName()
Gettign number of absolute axes for jinput device 1 (0)
Gettign number of relative axes for jinput device 1 (3)
Gettign number of buttons for jinput device 1 (4)
Getting bus type for device 1
Getting supported buttons for jinput device 1
Getting suported relative axes for jinput device 1
Getting suported absolute axes for jinput device 1
Getting supported buttons for jinput device 1


I think it might be an unflushed stream or so. Can you recontruct this? And do you want it to be like this? I think such an information should show up when the devices are gathered.

Qudus
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #3 - Posted 2005-08-18 22:43:12 »

Hi

Thanks comming from the native .so library. If you can compile the linux plugin, there is a -DDEBUG or similar in the ant build file in the linux plugin directory, if you remove that, then you should get no output, but you'll also get nothing to tell you what went wrong if it does, which it shouldn't Smiley

Endolf

Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #4 - Posted 2005-08-18 23:23:01 »

then you should get no output, but you'll also get nothing to tell you what went wrong if it does, which it shouldn't

That's not what I want. I just want runtime control over the output. As I said in my last post, this output is coming up after I called System.exit(0). I don't think this is the goal of this output. Shouldn't this output show up when thedevices are searched for and (hopefully) found? I think this is a bug, isn't it?

If the output came up during runtime of my program, I could easily redirect it to a local methode and bock it, if I like and pass it through, if I think it's necessary at that time.

Don't you agree?

Qudus

For providence: Sometimes my phrases come down the way I didn't mean them to. If it did, be assured, this should all just be contructive.
Offline Jeff

JGO Coder




Got any cats?


« Reply #5 - Posted 2005-08-18 23:42:05 »

In the past the delay has never been a big deal.  We generally dont exmaine the outpuit unless something goers wrong anyway Smiley

My suspicion is that the reason it coems at the end has something to do with the way Java and the native C code interract in using stdout so I doubt its fixable.


Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #6 - Posted 2005-08-18 23:52:25 »

I just started my program without eclipse and there the output come when it was meant to. But I still can't redirect it by redirecting System.out and System.err. Any Idea?
Offline Jeff

JGO Coder




Got any cats?


« Reply #7 - Posted 2005-08-19 00:35:40 »

Because its not Java.

Changing the Java doesnt do anything to the natvie code generating that.

As Endolf says, you need to rebuild the native lib with debug turned off.


Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #8 - Posted 2005-08-19 01:12:54 »

OK. I don't want to modify and rebuild a library. But how about passing a method to the java lib to switch this on and off? Maybe You could pass an Instance of a Stream Class to redirect it.

I agree with you, that this output can be necessary. But all the other time it's just ugly waste in my stdout.

What do you think about it?
Offline Jeff

JGO Coder




Got any cats?


« Reply #9 - Posted 2005-08-19 02:11:48 »

OK. I don't want to modify and rebuild a library. But how about passing a method to the java lib to switch this on and off? Maybe You could pass an Instance of a Stream Class to redirect it.

What would C code do with an instacne of Stream?

Actually, it WOULD be possible, through JNI, to call back into a Java object to send output. It woudl hwoever be needlessly slow.

You dont have to modify the library to eliminate the output.  The switches are already there.  You DO have to set a flag and run the build again.

As for modifying it.   You say you don't want to do any modification.  That means it likely will not be modified as  noone else is having an issue with this. You have a unique problem, you get to fix it.

Welcome to the wonders of Open Source.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #10 - Posted 2005-08-19 08:40:31 »

When I originally wrote the linux plugin, at the native level, I had the choice of just dumping to stdout, w compile time controlled logger, or a runtime controlled logger. I figured that there would be several stages to development, and that at some point in the future when enough testing had been done, the only output needed would be in error cases. One stage would be the early adoption of the library, which is where I would say we still are, then there would be a reasonably stable period. Whilst we are in the adoption phase, there are have been a number of queries that withought the debug, we would not have been able to fix. I'm in the process of sticking force feedback into the linux plugin (well, rumblers at least) and again the debug is needed.

I have used numerous loggers in java before and they all the discussions have the same comments about needing to check if the levels are enabled first etc, which was way beyond what I wanted, I just wanted an 'on/off' system, and a simple macro in the C code sorted it. It's not to everyones tastes, but it's damn quick when it's disabled, ie, there is no code there by the time the compiler gets it, so it's fast to run.

The messages comming out at funny points seems to be when you have some java process wrapping stdout, like eclipse, or ant, if I run the tests from an ant script I also get the delays.

I can pass you a .so that doesn't have the debug in it if you want?

Endolf

Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #11 - Posted 2005-08-19 13:48:35 »

You say you don't want to do any modification.  That means it likely will not be modified as  noone else is having an issue with this. You have a unique problem, you get to fix it.

Welcome to the wonders of Open Source.

The point is that it doesn't make any sense for me forking the code. If I make a modification found senseless by the library developer, and so will never be implemented ni releases, I'll always have to remake this modification. That would be no usable solution for me.

But I think, if I have some time in the next days, I'll go through the sourcecode of JInput and try to understand it better. If I find a thing worthy beeing changed, I'll change it and give you my modified version, so you can check if you like it.

I think I'll get along with the debugging output for some time. So you don't need to send me such a .so, endolf. Thanks anyway.

Qudus
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #12 - Posted 2005-08-19 14:26:14 »

Hi

There is no issue at all in others modifying the code, if you find issues you can either post them on the jinput forum, if you have a fix, then you can either post it here, or get developer access to the source and change it yourself. Obviously, if it's something major, we like to check with the other devs and users if it's ok, so everyone knows and a consecus is reached before anything goes in anyway.

If you have any more questions don't hesitate, questions and comments are what drives the api forwards.

Endolf

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (25 views)
2014-07-29 18:09:19

Riven (15 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (33 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (43 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!