Sponsored Content
Top Forums Shell Programming and Scripting how to make my own file as a running log file in bash Post 302509974 by blrguest on Friday 1st of April 2011 08:06:49 AM
Old 04-01-2011
Quote:
Originally Posted by sk1418
processes which are gonna invoke your script can write output into different files. say psid.out.log for example.

if you want only one log file, you may consider to add some prefix to each appended text, to indicate the log message was from which process.
Thnx for the suggestion.
however I want some sort of syncronization technique to my script so tht my output is consistant.Otherwise I need a mechanism how the log file(/var/log/messages) use to append automatically.
 

10 More Discussions You Might Find Interesting

1. Programming

Error while running C++ make file

The problem is that the original program was compiled using v5.0 MQ client but now we are using MQ client v5.3. Had modified the "make file" options as follows but still i could see the errors. #CLIENT_V5_LIBS = -limqb23ss -limqc23ss -lmqic -lmqmcs -lnsl -ldl CLIENT_V5.3_LIBS =... (1 Reply)
Discussion started by: hram
1 Replies

2. UNIX for Dummies Questions & Answers

getting help on finding exception in running log file

Hi all, I am trying to write a script for an application server log file where i want to put this script as a cron tab entry and it will check the server log file last 1000/500 line for every fifteen minute. i am using the script like this. count=`tail -n 1000 Trace.log | grep -c... (1 Reply)
Discussion started by: senthilkumar_ak
1 Replies

3. Shell Programming and Scripting

how to make a log file of extract time

Dear All, Please apology to me if this question already posted, because I try to find it but not found. I have make bash script to automatically download data from ftp and this running very well. and after the data downloaded it will automatically extract the data and keep in the specific... (2 Replies)
Discussion started by: chenboly
2 Replies

4. Programming

makeutility: how to get the make-file name inside of the make-file?

How I can get the current make-file name in a make-file So, if I run make with specified file:make -f target.mak is it possible to have the 'target' inside of the that 'target.mak' from the file name? (2 Replies)
Discussion started by: alex_5161
2 Replies

5. Shell Programming and Scripting

make the name of file and fetch few things from log file

Hello All, I am working on a script where I need to fetch the value from a log file and log file creates with different name but few thing are common DEV_INFOMGT161_MULTI_PTC_BLD01.Stage_All_to_stp2perf1.042312114644.log STP_12_02_01_00_RC01.Stage_stp-domain_to_stp2perf2.042312041739.log ... (2 Replies)
Discussion started by: anuragpgtgerman
2 Replies

6. Shell Programming and Scripting

[Solved] The SCRIPT command - Can we see the log file of a running session?

Hello. This is my situation. script .anything ls -l . ---How can I see the content of .anything using (i.e) cat .anything? If not possible can someone suggest a sequence to simulate a console-recorder to "observ" from a RUNNING script session? Thanks Paolo Please use code tags... (3 Replies)
Discussion started by: paolfili
3 Replies

7. Shell Programming and Scripting

BASH log file

hi .. am new to bash script.. #!/bin/bash logfile = "${HOME}/log/test.log" ./1.sh echo " script over " can anyone telme hw to set the logfile ?? the above code calls the 1.sh and echo statement gets printed in cmd prompt, but i could not see the log file . (8 Replies)
Discussion started by: Rahul619
8 Replies

8. UNIX for Dummies Questions & Answers

Bash/vi: Make file go away once I close it.

Hi Everyone, It's a little difficult to explain what exactly I am looking for. When I open a file in vi, and then close it, I get back the prompt, but I can still see the file on top. I don't want that. I want to be able to see all the previous commands which I have typed. For example: I... (4 Replies)
Discussion started by: the_learner
4 Replies

9. Shell Programming and Scripting

Bash script for looking in log file

Hello, I'm a beginner in shell scripting. I would really appreciate some help from the forum. I want to write a small script that will look in apache error log. If it finds the appropriate word. It would execute some commands. In my case the apache error log is situated in:... (2 Replies)
Discussion started by: ajaysingh99
2 Replies

10. Shell Programming and Scripting

Bash - make csv file

Hello, im trying to make csv file from a text file that it is the output of pssh command (multiple ssh ) now if i run the command date on all of our servers: i get this output : 14:02:46 192.168.25.230:22 Thu Jul 6 14:02:46 EEST 2017 192.168.70.230: Thu Jul 6 12:02:46 BST 2017 ... (1 Reply)
Discussion started by: batchenr
1 Replies
Mojo::Log(3pm)						User Contributed Perl Documentation					    Mojo::Log(3pm)

NAME
Mojo::Log - Simple logger SYNOPSIS
use Mojo::Log; # Log to STDERR my $log = Mojo::Log->new; # Customize log file location and minimum log level my $log = Mojo::Log->new(path => '/var/log/mojo.log', level => 'warn'); # Log messages $log->debug("Why isn't this working?"); $log->info("FYI: it happened again"); $log->warn("This might be a problem"); $log->error("Garden variety error"); $log->fatal("Boom!"); DESCRIPTION
Mojo::Log is a simple logger for Mojo projects. EVENTS
Mojo::Log can emit the following events. "message" $log->on(message => sub { my ($log, $level, @messages) = @_; ... }); Emitted when a new message gets logged. $log->unsubscribe('message'); $log->on(message => sub { my ($log, $level, @messages) = @_; say "$level: ", @messages; }); ATTRIBUTES
Mojo::Log implements the following attributes. "handle" my $handle = $log->handle; $log = $log->handle(IO::Handle->new); Log file handle used by default "message" event, defaults to opening "path" or "STDERR". "level" my $level = $log->level; $log = $log->level('debug'); Active log level, defaults to the value of the "MOJO_LOG_LEVEL" environment variable or "debug". These levels are currently available: "debug" "info" "warn" "error" "fatal" "path" my $path = $log->path $log = $log->path('/var/log/mojo.log'); Log file path used by "handle". METHODS
Mojo::Log inherits all methods from Mojo::EventEmitter and implements the following new ones. "new" my $log = Mojo::Log->new; Construct a new Mojo::Log object and subscribe to "message" event with default logger. "debug" $log = $log->debug('You screwed up, but that is ok'); Log debug message. "error" $log = $log->error('You really screwed up this time'); Log error message. "fatal" $log = $log->fatal('Its over...'); Log fatal message. "format" my $message = $log->format('debug', 'Hi there!'); my $message = $log->format('debug', 'Hi', 'there!'); Format log message. "info" $log = $log->info('You are bad, but you prolly know already'); Log info message. "is_level" my $success = $log->is_level('debug'); Check log level. "is_debug" my $success = $log->is_debug; Check for debug log level. "is_error" my $success = $log->is_error; Check for error log level. "is_fatal" my $success = $log->is_fatal; Check for fatal log level. "is_info" my $success = $log->is_info; Check for info log level. "is_warn" my $success = $log->is_warn; Check for warn log level. "log" $log = $log->log(debug => 'This should work'); Emit "message" event. "warn" $log = $log->warn('Dont do that Dave...'); Log warn message. SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>. perl v5.14.2 2012-09-05 Mojo::Log(3pm)
All times are GMT -4. The time now is 05:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy