System.out and native stdout after freopen
Hi.
I have a native application with an embedded JVM using JNI. In normal operation the native code does an freopen on stdout (before creation of the JVM). In this scenario System.out from the Java code is invisible.
How can the System.out be made to follow the native stdout?
JDK1.3 on Win32.
Many thanks,
Pete
Actually my problem went away when I rebuilt the main native app WITHOUT debug.
Only seems to happen if the .exe for the main native app is linked with debug options (I'm using MSVC).
This is easily reproducible, but now I know it won't affect final customers of my product I'm moving on and not spending any more time on it.
Pete
Similar Messages
-
System.out and System.err
Hi all,
This is a stupid newbie question, but I could not find the answer on the Web
site, so here goes: Where do System.out and System.err get written to? I'm
trying to deploy some plain-vanilla stateless session beans that do a bunch
of println() calls, but I can't see the output anywhere! The WebLogic
Console shows no messages, /myserver/weblogic.log has nothing interesting,
and there are no .log files anywhere that I can see. I even searched /tmp
and found nothing of interest. What am I missing? Do I have to explicitly
open a file for System.out and/or System.err? That doesn't sound right...
- danzThe simple answer to your questions are no and no.
I recently logged a problem with BEA WebLogic technical support regarding
this issue and their response is:
You have two choices. You can either use standard Java file i/o to write
your output to a file, or you can use our t3loggingservices to append
messages into the weblogic.log
The "jump point" for the logging services is at --
http://www.weblogic.com/docs51/classdocs/javadocs/weblogic/common/LogService
sDef.html
It is actually very easy to use -- after you import the proper packages into
your web application it is just as easy to use as System.out.println.
John J. Feigal Voice (651)766-8787 (main)
Sr. Technical Consultant (651)766-7249 (direct)
Ensodex, Inc. Fax (651)766-8792
4105 N. Lexington Ave., Suite 150 email [email protected]
Arden Hills, MN 55126 WebSite http://www.ensodex.com
"Jon Wynett" <[email protected]> wrote in message
news:[email protected]...
I'm running WebLogic as an NT Service. Is there any way to see the
System.out.println messages? Can they be redirected to the weblogic.log
file?
We were running through a DOS Window and saw all the messages, however we
ideally want to run Weblogic as a service.
"Rob Woollen" <[email protected]> wrote in message
news:[email protected]...
I'm guessing that you started the server with the .exe file on Windows.
If you're debugging with printlns, it's generally more conventient to
use the startWebLogic.sh or startWebLogic.cmd files to start the server
from a shell.
By default, you'll see stdout and stderr in the window.
-- Rob
Dan Zivkovic wrote:
Hi all,
This is a stupid newbie question, but I could not find the answer on
the
Web
site, so here goes: Where do System.out and System.err get written to?I'm
trying to deploy some plain-vanilla stateless session beans that do abunch
of println() calls, but I can't see the output anywhere! The WebLogic
Console shows no messages, /myserver/weblogic.log has nothinginteresting,
and there are no .log files anywhere that I can see. I even searched/tmp
and found nothing of interest. What am I missing? Do I have toexplicitly
open a file for System.out and/or System.err? That doesn't soundright...
- danz -
System.out and System.err How to get to show up in log
Does anyone know if there is anyway to get System.out and System.err
messages to appear in the log?
Trying to build and debug a JSP project is a complete nightmare when the
remote developers cannot see System.out or System.err messages from helper
classes.
Platform= Windows NT 4.0
Weblogic running as a Service
Thanks in advance!Write a wrapper class to redirect the std out to what ever stream you want.
HTH
Saman -
Hi, every time i try downloading ios5 it reaches 100% and then the connection times out and nothing happens after that; though the internet connection is fine as i can access other sites etc. what could be the problem?i tried using 2 different modems. Where can i download the ios5 from as my itunes is on my desktop which uses windows xp. Please help
Download iOS 5.1
iOS 5.1 (build 9B176) is compatible with iPad 1, iPad 2, iPhone 3GS, iPhone 4, iPhone 4S, iPod touch 3rd & 4th gen, and iPad 3. Additional builds are available for Apple TV 2 and Apple TV 3. The below download links are all direct downloads of iOS 5.1 from Apple.
iPad 1
iPad 2 Wi-Fi
iPad 2 GSM (AT&T)
iPad 2 CDMA (Verizon)
iPad 2,4
iPhone 3GS
iPhone 4 GSM (AT&T)
iPhone 4 CDMA (Verizon)
iPhone 4S
iPod touch 3G
iPod touch 4G
iPad 3 Wi-Fi
iPad 3 GSM
iPad 3 CDMA
Apple TV 2 (9B179b1)
Apple TV 3 (9B179b1)
Source: http://osxdaily.com/2012/03/07/ios-5-1-download/ -
Temporarily routing System.out and System.err to a String
Hi everybody,
Does anyone know of a way to temporarily route System.out and System.err directly from the console into a String, then set it back to its default to the console? I know how to reroute to a text area:
TextAreaOutputStream taos = new TextAreaOutputStream(yourTextArea);
PrintStream ps = new PrintStream(taos);
System.setErr(ps);
System.setOut(ps);But it doesn't seem like there is either a way to reroute to a String or a way to switch back to the default routing afterward. Can anyone give me some advice on how to do this, please?
Thanks,
Jezzica85Too late to the party?
import java.io.*;
public class Redirection {
public static void main(String[] args) {
System.out.println("To console");
PrintStream old = System.out;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
System.setOut(ps);
System.out.println("To memory");
System.out.print("No 'ln'");
//System.out.flush(); //needed?
System.setOut(old);
System.out.println("To console again?");
System.out.println("earlier I wrote...");
byte[] data = baos.toByteArray();
String message = new String(data);
System.out.println(message);
} -
Is it possible to redirect System.out and System.in for a thread
I would like to run two threads. One should keep writing to System.out and System.in. The other thread output written to System.out and System.in shoudl be captured and written to a file. Is this possible? I don't think so, but perhaps someone know some workaround.
raspedhmmm sure it's possible. You can write an outputstream that does different things depending on which thread is running, and then set system.out to a printstream that writes to that outputstream.
-
Rerouting System.out and System.err
Hi everybody,
I'm trying to make a small application with an agnostic back end that can print out its progress messages to either the console or a JTextArea, depending on whether the console front end or GUI front end is called. I originally created a small utility class that the agnostic back end extended, in which one could set a variable which told it to use the JTextArea or console. The solution seems a bit clumsy to me, though, so it crossed my mind; does anyone know if there is a way, in the main method of a program, to reroute System.out and System.err to a desired location?
Basically, I'd like functionality like this:
Console front end:
1. Start main
2. Create object for back end
3. All calls to System.out and System.err in back end route to console, as usual
GUI front end:
1. Start main
2. Create Object for back end
3. Create GUI
4. Set System.out and System.err to show up in GUI text field
5. All calls to System.out and System.err in back end route to text field in GUI
Is this possible? I have my somewhat hacked solution working fine, but I don't want to start ripping it apart too badly until I know if something simpler like this can work. Can anyone point me in the right direction, please?
Thanks,
Jezzica85Thanks for the explanation scphan,
In that case, I don't think that's exactly what I'm looking for.
To answer both your question and cotton's:
What I want to to is directly reroute System.out and System.err to a text area, only if I'm using a GUI. I'll try and explain it all, so if it gets long please bear with me--
I have 3 classes, Calculate, Console, and GUI.
Calculate is the back end of my application. Console is a front end class that allows the actions of Calculate to be run on the command line. GUI is a front end class that allows the actions of Calculate to be shown in a text area.
I currently have a class, Output, that Calculate extends, and uses to print out progress/error messages. Output has a JTextArea data member, and print/println data members. If the JTextArea is null, calling the print methods prints to the console, and if not, the print methods print to the text area. So, at the current moment, I have a solution similar to that which scphan described (although I didn't recognize the terminology at first--apologies, it's almost 3 AM here).
What I was wondering is if there is a simpler, more elegant way to do this. I have a few different small applications that have a similar setup to this one, and all the background classes must extend the Output class to work. If creating a class that every back end class must extend is the best way to do this, then I won't mess with what I have, but if there is a more elegant solution I've overlooked, I'd like to use that instead.
I hope that's clear, sorry if there was any confusion.
Thanks,
Jezzica85 -
Replace System.out and System.err
Hi there,
i got an Applet/Application Hybrid and i want to replace the System.out and System.err - Stream with my personal Streams.
When started as an Application it shell be given out to a file and when started as an Applet it shell be given out to the current HTML-Document...
But how do i realize that with the Applet. The thing with the Application and the file works fine, so don�t worry about that..
so in short my question is:
how can i replace/modify the System.out and System.err Streams in a way so that the output will be given the current HTML-Document when started as an Applet?
thx anyway
cu Errraddicatori know this method, but i don�t know how to make a PrintStream that gives the input to the HTML-Document...
excuse me if my kind of expressions were not so excactly...
thx anyway
cu Errraddicator -
OPMN system.out and system.err log rotation?
I would like to rotate the log generated by OPMN by default for system.out & system.err, which is named:
OC4J~APPNAME~home~default_island~1
I see the entries in the opmn.xml file for the ons.log and ipm.log which ARE being rotated properly. I've read that you can redefine the log file for system.out and system.err, but can't find any about rotating these logs.
Does anyone have any info about this topic?If anyone's curious and is trying to do this themselves, I eventually asked Oracle, who stated it could not be done.
-
Macintosh HD greyed out and shut down after progress bar complets
Hello everyone, after i manually closed my macbook by holding the shut down button for 5secs due to an application crush, my macbook pro doesnt seem to be able to boot anymore. It executes the progress bar under the apple icon on the screen (trying to repair my hd) and after it completes the process, it shuts down. When i press cmd+R, i can see from disk utilities the 500GB hard drive and the macintosh hd. The 500GB total hard drive is normal (even with no problems to fix after running verify and repair) but the Macintosh HD-part is greyed out and verify/repair fail with an error when i click on them. What should i do? i dont think its a hard drive failure. At least, how can i back up my system or some files? from disk utilities the new image function should be executed for the macintosh hd partition and not for the parent 500GB hard disk in order to make a backup, right?
1) In a Finder window, select the Macintosh HD. Can you see the contents? If yes, you can select to drag over files.
2) Download SuperDuper (free) When it opens does it recognize the internal drive in the popup? If yes, you will need to make a second portion on your external drive for the clone of your internal drive.
3) If you can't see the contents or the drive in Finder or SuperDuper then you will need to download and run Mavericks over the internal drive. -
System.out and application.out in JSP Channel
Can someone tell me where the System.out.println(...) output will go to if I put it in a Desktop JSP Channel?
Where will application.log("...") send the output to?
Thanks.System.out from servlets and JSPs goes to the container's standard output -- in portal's case, the web server's standard output.
By default this is /dev/null. If you run 'ipsserver start debug' the output will appear in your terminal window (/dev/stdout).
This isn't too useful if you have multiple developers, so we changed the definition of the log variable in the do_debug function in the ipsserver script so the output goes to a file under /var/opt when debugging is on. -
System.out and System.err to files
Hi !
Could somebody tell me, how I can forward all System.out.println and System.err.println Messages from
my Java modules (EJB, Servlets) to different files respectively.
Thanks
SteveI think you could create PrinStreamS from your desired output files and then use System.setOut(<...>) and System.setErr(<...>). Place this code in a servlet that you load at startup...
-
URGENT : System.out AND OACorexx files! log files more than 4Giga
Hi all,
I have a client with a custom done in OAF where there are a lot of System.out... and System.err "logs" print.
The problem is that these logs are written in OACorexxx files under Apache/Jserv/logs/jvm directory: in only 4 days more than 4G size!
Is possible to disable this logs?
Thanks,
CarloCalling java.lang.System.setOut(PrintStream out) will allow you to redirect the System.out calls. You can direct them to null.
--Shiv -
System unstable and requires reboot after 24 hours - HELP
I did a clean install of Leopard twice and the same issue appears. The system becomes unstable and requires a reboot. Mail doesn't function correctly and Firefox gives an error, "Another copy of Firefox is running. Only one copy can run at a time'.
The only option at this point is to reboot, however the system hangs on shutdown.Sorry for the delay and thanks for the response. what I mean by unstable is that the system will not perform as expected. The problem seems to be growing however. It use to only occur after 24 hours of up time. Now it seems to occur after the system goes to sleep. Twice I have put the system to sleep and each time when it wakes, I can not do anything. If I click an application Firefox, Yahoo, iChat, Mail, etc it will not respond. Forcing a quit on the application does nothing. Each time I have been forced to bring the system down hard. -Any help is appreciated.
-
Redirecting System.out and System.err to files
Is there a way I can configure my web-appliction (in web.xml or something) to redirect all the output (.err and .out) to specific files?
I think you could create PrinStreamS from your desired output files and then use System.setOut(<...>) and System.setErr(<...>). Place this code in a servlet that you load at startup...
Maybe you are looking for
-
Date Prompt in OBIEE 11.1.1.7.0
Good Afternoon, hope you all are well. We have the following issue in our production environment. Our Exact Date prompt is causing our reports to error, the reason being is that the relevant Fact table to the prompt has no data. Is there a piece of S
-
Mountain Lion and Docking on a MBP
At home I have a multiple USB port adaptor throught which I connnect mutiple peripherals to my MBP. In partilcular this is used to connect boththe hard drive I use for Time Machine and my HP pronter scanner. Since upgrading to Mountain Lion I find th
-
Problem with Exporting from Bridge CS5 to Social Media sites
Hi Adobe users, I'm a new French user of CS5 Bridge. My question is : Is it possible for me to export pictures from Bridge to Social Media Sites like Facebook & Flickr ? This topic (http://www.tipsquirrel.com/exporting-from-bridge-cs5-to-social-media
-
Adobe Create pdf icon does not appear in Firefox 36.0.1
I am using Windows 10 TP and have used Adobe Acrobat XI with Firefox for months now and have been able to click on the Adobe Icon on the FIrefox toolbar to convert web pages into an Acrobat file. In the last couple of weeks this icon has disappered b
-
Hi all, I installed JES2 and selected AM, Directory Service. when installer configure web server, at Enter SSL Administration Port [-1] {"<" goes back, "!" exits}I can't changed it to be 8989 or other ports. Enter SSL Administration Port [-1] {"<" go