PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > Redirection of logging to file & screen
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

Redirection of logging to file & screen

Réponse
 
LinkBack Outils de la discussion
Vieux 07/01/2008, 23h18   #1
huijstee@hotmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Redirection of logging to file & screen

Hi,

For redirecting STDOUT & STDERR to both screen and logfile, I use the
following method :

tee {logfile} >/dev/tty |&
exec 1>&p 2>&1

This works fine for non-interactive scripts. But when I use this in an
interactive script, the user input (STDIN goten from the terminal)
does not go into the logfile, but is displayed on screen.

Can anyone tell me what to set in order for STDIN to be displayed on
the terminal and to go into the log file?


Thanks in advance.

Mark
  Réponse avec citation
Vieux 08/01/2008, 03h44   #2
Barry Margolin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Redirection of logging to file & screen

In article
<0752b97b-1a76-446b-868f-d7c61218cf6f@q39g2000hsf.googlegroups.com>,
huijstee@hotmail.com wrote:

> Hi,
>
> For redirecting STDOUT & STDERR to both screen and logfile, I use the
> following method :
>
> tee {logfile} >/dev/tty |&
> exec 1>&p 2>&1
>
> This works fine for non-interactive scripts. But when I use this in an
> interactive script, the user input (STDIN goten from the terminal)
> does not go into the logfile, but is displayed on screen.
>
> Can anyone tell me what to set in order for STDIN to be displayed on
> the terminal and to go into the log file?


There's no automatic way to do this that I know of. You're redirecting
output, the user's typing is input. It's only being seen because of the
terminal driver's echoing, it's not actually being written to stdout.

Why don't you run your application under script to log everything?

--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
  Réponse avec citation
Vieux 08/01/2008, 04h42   #3
Ed Morton
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Redirection of logging to file & screen

huijstee@hotmail.com wrote:

> Hi,
>
> For redirecting STDOUT & STDERR to both screen and logfile, I use the
> following method :
>
> tee {logfile} >/dev/tty |&
> exec 1>&p 2>&1
>
> This works fine for non-interactive scripts. But when I use this in an
> interactive script, the user input (STDIN goten from the terminal)
> does not go into the logfile, but is displayed on screen.
>
> Can anyone tell me what to set in order for STDIN to be displayed on
> the terminal and to go into the log file?
>
>
> Thanks in advance.
>
> Mark


You'd need to run an external tool like "screen", "script" or "hrdcpy"
which log the user input and tool output.

Ed.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 14h14.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10670 seconds with 11 queries