Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

ftp::Cd error message
I'm trying to suppress some output from ftp::Cd in a script I'm writing.  To
 do so, I figure I'd put it in a catch block, as seen here:

catch {set rtn [ftp::Cd $serverHandle $directory]}
if {$rtn != 1} {
error "Unable to change to directory $directory"
}

If the ftp::Cd does fail (rtn is set to 0), it prints out an error message (
to standard out, not standard err), regardless of its place inside the catch
 block.

Does anybody know whats wrong here/ another way to suppress this output?

Thanks,
-Noah


Report this thread to moderator Post Follow-up to this message
Old Post
Richards Noah \(IFR LIT MET\)
12-10-04 08:59 PM


Re: ftp::Cd error message
On Fri, 10 Dec 2004, Richards Noah (IFR LIT MET) wrote:

> I'm trying to suppress some output from ftp::Cd in a script I'm writing.
> To do so, I figure I'd put it in a catch block, as seen here:
>
> catch {set rtn [ftp::Cd $serverHandle $directory]}
> if {$rtn != 1} {
>    error "Unable to change to directory $directory"
> }
>
> If the ftp::Cd does fail (rtn is set to 0), it prints out an error
> message (to standard out, not standard err), regardless of its place
> inside the catch block.
>
> Does anybody know whats wrong here/ another way to suppress this output?

ftp::Cd calls ftp::DisplayMsg which in turn calls log::log.  With the log
package in tcllib you can customize what levels of severity are logged,
where they're logged to, and how.  See:

http://tcllib.sourceforge.net/doc/log.html

You probably want log::lvSupress error.

Michael

Report this thread to moderator Post Follow-up to this message
Old Post
Michael A. Cleverly
12-29-04 08:58 AM


Re: ftp::Cd error message
"Michael A. Cleverly" <michael@cleverly.com> wrote in message
news:Pine.OSX.4.60.0412281444440.7432@powerbook.cleverly.com...
> On Fri, 10 Dec 2004, Richards Noah (IFR LIT MET) wrote:
> 
>
> ftp::Cd calls ftp::DisplayMsg which in turn calls log::log.  With the log
> package in tcllib you can customize what levels of severity are logged,
> where they're logged to, and how.  See:
>
>      http://tcllib.sourceforge.net/doc/log.html
>
> You probably want log::lvSupress error.
>
> Michael

Thanks, Michael, that works well!  Just for future reference, is this
documented somewhere?  In the ftp documentation
(http://tcllib.sourceforge.net/doc/ftp-docs/index.html) it meantions that
ftp::VERBOSE and ftp::DEBUG control the output, but neither of these will
stop the error output.  From what I can see, there is no mention of the use
of log.  Is there someplace else that this is documented (that you know of)?
Also, is this behavior typical of tcllib packages?  Thanks for your help.



Report this thread to moderator Post Follow-up to this message
Old Post
Richards Noah \(IFR LIT MET\)
12-29-04 08:59 PM


Re: ftp::Cd error message
On Wed, 29 Dec 2004, Richards Noah (IFR LIT MET) wrote:


> "Michael A. Cleverly" <michael@cleverly.com> wrote:
> 

> Thanks, Michael, that works well!  Just for future reference, is this
> documented somewhere? In the ftp documentation
> (http://tcllib.sourceforge.net/doc/ftp-docs/index.html) it meantions
> that ftp::VERBOSE and ftp::DEBUG control the output, but neither of
> these will stop the error output.  From what I can see, there is no
> mention of the use of log.  Is there someplace else that this is
> documented (that you know of)? Also, is this behavior typical of tcllib
> packages?  Thanks for your help.

I think more than just the ftp packages use log::log to log output, but
without grep'ing through the source, I'm not sure exactly which ones.
Since it's apparently not documented in the man page for the ftp package,
I'm guessing it might ob the Wiki somewhere (or I picked up on it reading
through the ftp source some time back).  Not sure where I learned it now,
to be honest.  :-)

We should submit an updated ftp man page to the tcllib project...

Michael

Report this thread to moderator Post Follow-up to this message
Old Post
Michael A. Cleverly
12-30-04 08:59 PM


Re: ftp::Cd error message
Michael A. Cleverly schrieb:
> On Wed, 29 Dec 2004, Richards Noah (IFR LIT MET) wrote:
>
> 
>
> 
>
>
> I think more than just the ftp packages use log::log to log output, but
> without grep'ing through the source, I'm not sure exactly which ones.
> Since it's apparently not documented in the man page for the ftp
> package, I'm guessing it might ob the Wiki somewhere (or I picked up on
> it reading through the ftp source some time back).  Not sure where I
> learned it now, to be honest.  :-)
>
> We should submit an updated ftp man page to the tcllib project...

Most of the server or client packages in tcllib use one of the log or
logger packages to provide log messages.
The modules that Andreas Kupries mantains mostly use log (as he is the
author of log), some of the others use log or logger, based on personal
preference. I prefer logger for example (but I'm biased as co-maintainer
of the logger module).

Perhaps there should be a general guidline or coding advice for tcllib
packages how logging should be handled in general, as it is a common
problem and most modules could use it. At the moment its more or less
the decision of the module owner.

This raises the dependency question, do we want more dependencies inside
tcllib?

Michael





Report this thread to moderator Post Follow-up to this message
Old Post
Michael Schlenker
12-30-04 08:59 PM


Re: ftp::Cd error message
Michael A. Cleverly schrieb:
> On Wed, 29 Dec 2004, Richards Noah (IFR LIT MET) wrote:
>
> 
>
> 
>
>
> I think more than just the ftp packages use log::log to log output, but
> without grep'ing through the source, I'm not sure exactly which ones.
> Since it's apparently not documented in the man page for the ftp
> package, I'm guessing it might ob the Wiki somewhere (or I picked up on
> it reading through the ftp source some time back).  Not sure where I
> learned it now, to be honest.  :-)
>
> We should submit an updated ftp man page to the tcllib project...

Most of the server or client packages in tcllib use one of the log or
logger packages to provide log messages.
The modules that Andreas Kupries mantains mostly use log (as he is the
author of log), some of the others use log or logger, based on personal
preference. I prefer logger for example (but I'm biased as co-maintainer
of the logger module).

Perhaps there should be a general guidline or coding advice for tcllib
packages how logging should be handled in general, as it is a common
problem and most modules could use it. At the moment its more or less
the decision of the module owner.

This raises the dependency question, do we want more dependencies inside
tcllib?

Michael





Report this thread to moderator Post Follow-up to this message
Old Post
Michael Schlenker
12-30-04 08:59 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Tcl archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:51 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.