stdout

C++ WxWidgets: Redirecting Stdout to a wxTextCtrl across mulitple threads

My application is a multi threaded app (using wxThreads). At the moment, the main thread along with it's child worker threads are outputting various messages to Stdout (using cout). I have a new frame/window with a wxTextCtrl, and would like to redirect all the StdOut messages in to it. GuiLogFrame *logframe; logframe = new...

Python Printing StdOut As It Recieved.

I'm trying to run wrap a simple (windows) command line tool up in a PyQt GUI app that I am writing. The problem I have is that the command line tool throws it's progress out to stdout (it's a server reset command so you get "Attempting to stop" and "Restarting" type output. What I am trying to do is capture the output so I can display ...

Continuously read from STDOUT of external process in Ruby

I want to run blender from the command line through a ruby script, which will then process the output given by blender line by line to update a progress bar in a GUI. It's not really important that blender is the external process whose stdout I need to read. I can't seem to be able to catch the progress messages blender normally prints ...

Redirect both cout and stdout to a string in C++ for Unit Testing

I'm working on getting some legacy code under unit tests and sometimes the only way to sense an existing program behavior is from the console output. I see lots of examples online for how to redirect stdout to another file in C++, but is there a way I can redirect it to an in-memory stream so my tests don't have to rely on the disk? I'...

Execute a process and return its standard output in VC++

What's the easiest way to execute a process, wait for it to finish, and then return its standard output as a string? Kinda like backtics in Perl. Not looking for a cross platform thing. I just need the quickest solution for VC++. Any ideas? ...

How can I direct output from a program to the console and a log file at same time?

How can I print the output to terminal and file at the same time? $ perl foo.pl > foout.txt does not allow me to see live process. Is there any way I can see the output process real time and getting at the end the output of the screen on a file? ...

log4j redirect stdout to DailyRollingFileAppender

I have a java app that uses log4j. Config: log4j.rootLogger=info, file log4j.appender.file=org.apache.log4j.DailyRollingFileAppender log4j.appender.file.File=${user.home}/logs/app.log log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%d [%t] %c %p %m%n So all the log statements a...

How to create a pseudo-tty for reading output and writing to input

I am using fork() and execvp() to spawn a process that must believe it is connected to an interactive terminal for it to function properly. Once spawned, I want to capture all the output from the process, as well as be able to send input to the process. I suspect psuedo-ttys may help here. Does anyone have a snippet on how to do this?...

How to redirect the output of a PowerShell to a file during its execution

I have a Powershell script for which I would like to redirect the output to a file. The problem is that I cannot change the way this script is called. So I cannot do: .\MyScript.ps1 > output.txt How to redirect the output of a Powershell script during its execution? Thanks! ...

Can I redirect the stdout in python into some sort of string buffer?

I'm using python's ftplib to write a small FTP client, but some of the functions in the package don't return string output, but print to stdout. I want to redirect stdout to an object which I'll be able to read the output from. I know stdout can be redirected into any regular file with: stdout = open("file", "a") But I prefer a metho...

How do I see stdout when running Django tests?

When I run tests with ./manage.py test, whatever I send to the standard output through print doesn't show. When tests fail, I see an "stdout" block per failed test, so I guess Django traps it (but doesn't show it when tests pass). ...

write() to stdout and printf output not interleaved?

#include <stdio.h> #define MAXLEN 256 int main() { int n; char buf[MAXLEN]; while((n = read(0,buf,sizeof(buf))) != 0){ printf("n: %d:",n); write(1,buf,n); } return 1; } The output of the program is read read write write n: 5:n: 6: The output of printf comes after pressing Ctrl+D at the standard input and not alon...

Python Subprocess - Redirect stdout/err to two places

Hi, I have a small python script which invokes an external process using subprocess. I want to redirect stdout and stderr to both a log file and to the terminal. How can this be done? Thanks, Udi ...

Not able to use 7-Zip to compress stdin and output with stdout?

I get the error "Not implemented". I want to compress a file using 7-Zip via stdin then take the data via stdout and do more conversions with my application. In the man page it shows this example: % echo foo | 7z a dummy -tgzip -si -so > /dev/null I am using Windows and C#. Results: 7-Zip 4.65 Copyright (c) 1999-2009 Igor Pavlov 2...

How can I make a hidden, disposable console application and communicate with it?

I've written a small console application to wrap a third-party DLL that has issues. I am calling it from a GUI application using _popen, and just want to read a value from the console program's standard output. In doing so, an undesirable console window is briefly displayed. I am aware that this can be avoided by using a certain STARTUP...

Getting rid of Python console in wxPython under Windows

How to get rid of the console that shows up as standard output when running wxPython programs in Windows? ...

How can I suppress output to stdout and stderr in Log4perl?

I have this sub to initialize my logger: sub initLogfiles{ Log::Log4perl->easy_init($INFO); # We log all debug, info, warn, error and fatal messages. my $userlogappender = Log::Log4perl::Appender->new( "Log::Log4perl::Appender::File", filename => USERLOGFILE, mode => "append", recreate => ...

How to configure logs/catalina.out of tomcat 6 for per-app. (Configure web-app specific log file for sys.out, sys.err)

Hi All, Requirement is this ... We have our 3 web-applications deployed in RHEL-5 server, we deployed apps with tomcat 6.0.16. We want to configure stdout, stderr, which are coming in tomcat/logs/catalina.out in app specific log file like, tomcat/logs/app1.log tomcat/logs/app2.log tomcat/logs/app3.log we are using log4j, but it is o...

Open DOS window and spew debug messages from DLL

I am currently calling a DLL from labview, but I need to be able to debug it realtime (because of it's accessing time sensitive hardware). I would like to just printf() my error assert messages but I am unsure about how to open a DOS window from within the DLL to dump error information to. Has anyone done this before? I know I could do t...

How can I reinitialize Perl's STDIN/STDOUT/STDERR?

I have a Perl script which forks and daemonizes itself. It's run by cron, so in order to not leave a zombie around, I shut down STDIN,STDOUT, and STDERR: open STDIN, '/dev/null' or die "Can't read /dev/null: $!"; open STDOUT, '>>/dev/null' or die "Can't write to /dev/null: $!"; open STDERR, '>>/dev/null' or die "Can't write to /dev/nu...