Sponsored Content
Full Discussion: ksh Logging
Top Forums UNIX for Beginners Questions & Answers ksh Logging Post 303032618 by aixkidbee on Thursday 21st of March 2019 04:31:16 AM
Old 03-21-2019
ksh Logging

Hi,

I want to run my script and want to ensure it captures all logging.

For e.g I got this from another forum

Code:
# Redirect the current stderr into stdout
exec 2>&1
# Redirect the current stdout into the log file
exec 1>timer_log.log

The script will print stderr onto the putty terminal and log all script output into timer_log.log
How can I also print the stdout to the putty terminal too.
I am using a KSH script.

Thanks.




Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 03-21-2019 at 05:45 AM.. Reason: Added CODE tags.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Logging

I have a SCO R5 Open Server Box running at a remote location, and from time to time it seems to "spontaneously" re-boot itself. Is there a specific log file that I can examine to see why the machine is doing this ? Any suggestions gratefully appreciated (1 Reply)
Discussion started by: pcs7088
1 Replies

2. Shell Programming and Scripting

Logging

G'day Just wondering if anyone out there knows how to log files, using the example I provided in the earlier message / question earlier today: :confused: If I was to backup a file, how could I setup a log file to record the filename, date (This one I've got figured), and that the file was... (4 Replies)
Discussion started by: Aussie_Bloke
4 Replies

3. UNIX for Dummies Questions & Answers

logging when someone changes to su

Is there a file that captures info whenever someone logs to su? i know it comes across as standard output on the server, but is it saved anywhere? Time and date info included?? thanks, kym (1 Reply)
Discussion started by: kymberm
1 Replies

4. UNIX for Dummies Questions & Answers

Asking about logging in

Hi, just wriiten a sh script and as my script will try to log into another server to delete some files but when i run , it keeps on saying that my files do not exist. It seems to refer to my local directory instead. Below is my script : FTP_HOST=ip_number FTP_USER="user password" ... (1 Reply)
Discussion started by: blueberry80
1 Replies

5. UNIX for Dummies Questions & Answers

need more logging

Hi all! On our current Solaris 8 machine we only have "standard" logging configured, and now i need to put on more. What i specificly need is time in the logfiles. Ex. When a user is logging in, when a user makes it self SU. etc. Regards... dOzY (3 Replies)
Discussion started by: dozy
3 Replies

6. Post Here to Contact Site Administrators and Moderators

Constant Logging In (After Logging Out)

Hi Everyone. First, I want to thank all of you for letting me participate in this great group. I am having a bit of a problem. After I get an email from a responder, I login to make my reply. In the mean time I get another response by email from another member, I go to reply to them and I... (6 Replies)
Discussion started by: Ccccc
6 Replies

7. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

8. Shell Programming and Scripting

ksh - find command with 2 actions attached and error logging

Hi there, I'm encountering problems on an AIX system when using following in my script. find . -name *.edi -type f -exec sh -c 'scp {} $user@$server:$path || exit 5; mv {} $sent || exit 7' \; the error i get is following find: 0652-018 An expression term lacks a required... (4 Replies)
Discussion started by: Kerberos
4 Replies

9. Shell Programming and Scripting

Adding logging feature to ksh script?

Good morning all, I have a ksh script that I would like to log all "Terminal" out to a log file. I have tried several different methods to no avail! Below is my script and any advice or assitance would be great! The script works great but can not figure out how to log all outputs to a log... (4 Replies)
Discussion started by: TAllison
4 Replies

10. Linux

Syslog not logging successful logging while unlocking server's console

When unlocking a Linux server's console there's no event indicating successful logging Is there a way I can fix this ? I have the following in my rsyslog.conf auth.info /var/log/secure authpriv.info /var/log/secure (1 Reply)
Discussion started by: walterthered
1 Replies
Poet::Log(3pm)						User Contributed Perl Documentation					    Poet::Log(3pm)

NAME
Poet::Log -- Poet logging SYNOPSIS
# In a conf file... log: defaults: level: info output: poet.log layout: "%d{dd/MMM/yyyy:HH:mm:ss.SS} [%p] %c - %m - %F:%L - %P%n" category: CHI: level: debug output: chi.log layout: "%d{dd/MMM/yyyy:HH:mm:ss.SS} %m - %P%n" MyApp::Foo: output: stdout # In a script... use Poet::Script qw($log); # In a module... use Poet qw($log); # In a component... my $log = $m->log; # For an arbitrary category... my $log = Poet::Log->get_logger(category => 'MyApp::Bar'); # then... $log->error("an error occurred"); $log->debugf("arguments are: %s", @_) if $log->is_debug(); DESCRIPTION
Poet uses Log::Any and Log::Log4perl for logging, with simplified configuration for the common case. Log::Any is a logging abstraction that allows CPAN modules to log without knowing about which logging framework is in use. It supports standard logging methods ("$log->debug", "$log->is_debug") along with sprintf variants ("$log->debugf"). Log4perl is a powerful logging package that provides just about any logging-related feature you'd want. One of its only drawbacks is its somewhat cumbersome configuration. So, we provide a way to configure Log4perl simply through Poet configuration if you just want common features. Note: Log4perl is not a strict dependency for Poet. Log messages will simply not get logged until you install it or until you modify logging for your app. CONFIGURATION
The configurations below can go in any Poet conf file, e.g. "local.cfg" or "global/log.cfg". Here's a simple configuration that caches everything to "logs/poet.log" at "info" level. This is also the default if no configuration is present. log: defaults: level: info output: poet.log layout: %d{dd/MMM/yyyy:HH:mm:ss.SS} [%p] %c - %m - %F:%L - %P%n Here's a more involved configuration that maintains the same default, but adds several categories that are logged differently: log: defaults: level: info output: poet.log layout: "%d{dd/MMM/yyyy:HH:mm:ss.SS} [%p] %c - %m - %F:%L - %P%n" category: CHI: level: debug output: chi.log layout: "%d{dd/MMM/yyyy:HH:mm:ss.SS} %m - %P%n" MyApp::Foo: output: stdout For the default and for each category, you can specify three different settings: o level - one of the valid log4perl levels (fatal, error, warn, info, debug, trace) o output - can be a relative filename (which will be placed in the Poet log directory), an absolute filename, or the special names "stdout" or "stderr" o layout - a valid log4perl PatternLayout string. If a setting isn't defined for a specific category then it falls back to the default. In this example, "MyApp::Foo" will inherit the default level and layout. Notice that we use '::' instead of '.' to specify hierarchical category names, because '.' would interfere with Poet::Conf dot notation. Finally, if you must use a full Log4perl configuration file, you can specify it this way: log: log4perl_conf: /path/to/log4perl.conf USAGE
Obtaining log handle o In a script (log category will be 'main'): use Poet::Script qw($log); o In a module "MyApp::Foo" (log category will be 'MyApp::Foo'): use Poet qw($log); o In a component "/foo/bar" (log category will be 'Mason::Component::foo::bar'): my $log = $m->log; o Manually for an arbitrary log category: my $log = Poet::Log->get_logger(category => 'Some::Category'); # or my $log = MyApp::Log->get_logger(category => 'Some::Category'); Using log handle $log->error("an error occurred"); $log->debugf("arguments are: %s", @_) if $log->is_debug(); See "Log::Any|Log::Any" for more details. MODIFIABLE METHODS
These methods are not intended to be called externally, but may be useful to override or modify with method modifiers in subclasses. Their APIs will be kept as stable as possible. initialize_logging Called once when the Poet environment is initialized. By default, initializes log4perl with the results of "generate_log4perl_config" and then calls "Log::Any::Adapter->set('Log4perl')". You can modify this to initialize log4perl in your own way, or use a different Log::Any adapter, or use a completely different logging system. generate_log4perl_config Returns a log4perl config string based on Poet configuration. You can modify this to construct and return your own config. SEE ALSO
Poet AUTHOR
Jonathan Swartz <swartz@pobox.com> COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Jonathan Swartz. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-06-05 Poet::Log(3pm)
All times are GMT -4. The time now is 10:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy