Hi, guys
Basiclly, it is automated testing system. There is a main python script
that handles the testing campagin. This main script will call another
script that will in turn runs a few hundered individual python scripts.
Here is my problem. I want to log everything displayed in the screen
after I start the main python script. Things include unhandled
exceptions , message from print statement and other sources.
Basically, if it is displayed on the screen, I want to log it..
It might not be a pythons specific problem. Does anyone know a small
tool does that job?
Thanks. 4 3898
Barry wrote:
Hi, guys
Basiclly, it is automated testing system. There is a main python script
that handles the testing campagin. This main script will call another
script that will in turn runs a few hundered individual python scripts.
Here is my problem. I want to log everything displayed in the screen
after I start the main python script. Things include unhandled
exceptions , message from print statement and other sources.
Basically, if it is displayed on the screen, I want to log it..
It might not be a pythons specific problem. Does anyone know a small
tool does that job?
Thanks.
If it's on linux you can just redirect the screen output to a file:
python initialfile.py 1>stdout.txt 2>stderr.txt
or if you want standard out and standard error to go to the same file:
python initialfile.py 1>output.txt 2>output.txt
or if you don't want to see anything on standard error:
python initialfile.py 1>output.txt 2>/dev/null
As for windows, I'll test it now...
It turns out you can at least redirect the output to a file, I'm not
sure what it does with standard error or even if it exists or not.
python initialfile.py output.txt
should work.
Hope it helps,
Cameron.
At Thursday 7/12/2006 23:21, Cameron Walsh wrote:
Here is my problem. I want to log everything displayed in the screen
after I start the main python script. Things include unhandled
exceptions , message from print statement and other sources.
Basically, if it is displayed on the screen, I want to log it..
If it's on linux you can just redirect the screen output to a file:
python initialfile.py 1>stdout.txt 2>stderr.txt [...]
As for windows, I'll test it now...
It turns out you can at least redirect the output to a file, I'm not sure what it does with standard error or even if it exists or not.
python initialfile.py output.txt
It's the same syntax as noted for linux above. 1is the same as alone.
If ALL the testing is done on a single program (that is, no os.system
or spawn or subprocess...) then you could just replace sys.stdout and
sys.stderr with another open file (or file-like) object.
--
Gabriel Genellina
Softlab SRL
_______________ _______________ _______________ _____
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
Gabriel Genellina wrote:
At Thursday 7/12/2006 23:21, Cameron Walsh wrote:
Here is my problem. I want to log everything displayed in the screen
after I start the main python script. Things include unhandled
exceptions , message from print statement and other sources.
Basically, if it is displayed on the screen, I want to log it..
If it's on linux you can just redirect the screen output to a file:
python initialfile.py 1>stdout.txt 2>stderr.txt
[...]
As for windows, I'll test it now...
It turns out you can at least redirect the output to a file, I'm not
sure what it does with standard error or even if it exists or not.
python initialfile.py output.txt
It's the same syntax as noted for linux above. 1is the same as alone.
If ALL the testing is done on a single program (that is, no os.system
or spawn or subprocess...) then you could just replace sys.stdout and
sys.stderr with another open file (or file-like) object.
Redirection in Windows is explained here: http://www.microsoft.com/resources/d....mspx?mfr=true
Cameron Walsh schrieb:
>
If it's on linux you can just redirect the screen output to a file:
python initialfile.py 1>stdout.txt 2>stderr.txt
As for windows, I'll test it now...
It turns out you can at least redirect the output to a file, I'm not
sure what it does with standard error or even if it exists or not.
python initialfile.py output.txt
should work.
>cmd
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
>type output.py
import sys
print 'This is print.'
sys.stdout.writ e('This is stdout.write()\ n')
sys.stderr.writ e('This is stderr.write()\ n')
>python output.py 1>stdout.txt 2>stderr.txt
>type stdout.txt
This is print.
This is stdout.write()
>type stderr.txt
This is stderr.write()
Seems on XP it works too.
Leonhard This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Thomas Schulz |
last post by:
Hello,
I'm using the logging package from python 2.3 on RH linux.
Everything in the test program below works fine if we just use the log
configuration with 'logging.basicConfig'. For the example below we get
the expected output:
ERROR:loggerName:error1 msg
ERROR:loggerName:error2 msg
|
by: Eric DeWall |
last post by:
In trying to clean up the inevitable debug printing littered through some
code, I started reading up on the 'logging' module. Browsing groups
indicates that the design of the module is controversial but personally I'm
very happy to see such a full-featured logger as part of the standard
distribution. Here's my problem though (using 2.3.3) - I'm trying to write
some reusable classes that _optionally_ use the logging module. So a class...
|
by: jjesso |
last post by:
I am trying to add a new logging level.
logging.config.fileConfig("bengineLog.cfg")
logging.CLIENT = logging.INFO + 1
logging.addLevelName( logging.CLIENT, 'CLIENT' )
logging.root.setLevel( )
logger = logging.getLogger(None)
logging.Logger.client('test')
I get error:
|
by: Maksim Kasimov |
last post by:
hello
in my modules, I'm using logging module, doing thus (there is a few modules):
in module1.py:
hdl = logging.StreamHandler()
fmt = logging.Formatter("%(name)s:\t%(levelname)s:\t%(asctime)s:\t%(message)s")
hdl.setFormatter(fmt)
log = logging.getLogger('module1')
|
by: Rotem |
last post by:
Hi,
while working on something in my current project I have made several
improvements to the logging package in Python, two of them are worth
mentioning:
1. addition of a logging record field %(function)s, which results in
the name
of the entity which logged the record. My version even deduces the
class name in the case which the logger is a bound method, and assuming
the name of the "self" variable is indeed "self".
| |
by: robert |
last post by:
As more and more python packages are starting to use the bloomy
(Java-ish) 'logging' module in a mood of responsibility and as I am not
overly happy with the current "thickener" style of usage, I want to put
this comment and a alternative most simple default framework for
discussion.
Maybe there are more Python users which like to see that imported
(managed) logging issue more down-to-earth and flexible ? ...
Vinay Sajip wrote:
>...
|
by: Eric S. Johansson |
last post by:
I need to to be able to conditionally log based on the method the log
statement is in and one other factor like a log level. in order to do
so, I need to be able to automatically find out the name of the method
and its class but I haven't found out how to do that yet.
for example,
class catus(Felis):
def Siamese_cat( yowl, purr, demand_food):
|
by: samwyse |
last post by:
In the Python 2.5 Library Reference, section 14.5.3 (Logging to
multiple destinations), an example is given of logging to both a file
and the console. This is done by using logging.basicConfig() to
configure a log file, and then calling
logging.getLogger('').addHandler(console) to add the console.
However, in section 14.5.4 (Sending and receiving logging events
across a network), a call is made to
rootLogger.addHandler(socketHandler),...
|
by: Thomas Heller |
last post by:
I'm using the logging module in my comtypes library to log
'interesting' things that happen. In other words, the idea
is if the user of the library is interested in the details that
happen in the package internally, he (she?) would configure
a logging level and handlers that write the log messages where it
is convenient.
This works great, with one exception:
If the script using the library does NOT configure logging, and somewhere the...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |