I want to make a logfile with error messages, like this:
(collumms: CUSTNR DATE TIME ERROR MESSAGE)
I made this script:
But the variabele MESSAGE is printed wrong. The logfile looks something likes this:
One of the problems are the spaces between de words in the MESSAGE strings.
How can I solve this/these problems?
Hi
How could I use the command printf to display a big file.
So ex. I've a script with some variables like:
V1=358504 V2=FD0147 V3=dev5 V4=94577 V5=0 V6=UNIX V7=Policy V8=server V9=04/15/05 V10=19:18:41 V11=2341321467
while read V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11
do
printf "\n%s %s %s... (1 Reply)
Hi,
I am very confused with my printf command.
Somehow one variable can't line up with others...
newstart2 ="Mon Nov 11 01 00:00:00 2002"
printf "%-20s" $newstart2
Here is the output:
Mon Nov 11
01 00:00:00 2002
It spread out to two lines..
Why? (1 Reply)
hello, Im at another part of the program i am writing. Where i think i'm going to need to use the printf command.
If anyone can help me figure out the printf layout i would greatly appreicate it.
thanks (4 Replies)
Hi,
I a sequance number from 1-999 and i want asing the value like 001,002..999
Exp:
file_001
file_002
file_003...
file_999
How can i disaplay the sequnace number as mention above. (3 Replies)
hello,
I'm trying to display Unix variable using printf command.
Code:
awk '{ if ( $0 ~ /string/ ) {
printf( "%s\n%s\n",$0,"dsd"); #this one works
printf( "%s\n%s\n",$0,$HOME); #this does not work
} else {
print $0;
}
}' param1_1.txt
I could use here echo command but I'm... (2 Replies)
A big hello to everyone tagged to this site of knowledge . This is the first post of mine and I am looking forward to an enjoyable stint in this forum where I get to know a lot of new ideas and share whatever knowledge (its not much though :) ) I have acquired throughout my career so far with... (4 Replies)
Discussion started by: kumarjt
4 Replies
LEARN ABOUT DEBIAN
log::report::dispatcher::callback
Log::Report::Dispatcher::Callback(3pm) User Contributed Perl Documentation Log::Report::Dispatcher::Callback(3pm)NAME
Log::Report::Dispatcher::Callback - call a code-ref for each log-line
INHERITANCE
Log::Report::Dispatcher::Callback
is a Log::Report::Dispatcher
SYNOPSIS
sub cb($$$)
{ my ($options, $reason, $message) = @_;
...
}
dispatcher Log::Report::Dispatcher::Callback => 'cb'
, callback => &cb;
dispatcher CALLBACK => 'cb' # same
, callback => &cb;
DESCRIPTION
This basic file logger accepts a callback, which is called for each message which is to be logged. When you need complex things, you may
best make your own extension to Log::Report::Dispatcher, but for simple things this will do.
METHODS
Constructors
$obj->close
See "Constructors" in Log::Report::Dispatcher
Log::Report::Dispatcher::Callback->new(TYPE, NAME, OPTIONS)
-Option--Defined in --Default
accept Log::Report::Dispatcher depend on mode
callback <required>
charset Log::Report::Dispatcher <undef>
format_reason Log::Report::Dispatcher 'LOWERCASE'
locale Log::Report::Dispatcher <system locale>
mode Log::Report::Dispatcher 'NORMAL'
accept => REASONS
callback => CODE
Your "callback" is called with four parameters: this dispatcher object, the options, a reason and a message. The "options" are the
first parameter of Log::Report::report() (read over there). The "reason" is a capitized string like "ERROR". Finally, the "message"
is a Log::Report::Message.
charset => CHARSET
format_reason => 'UPPERCASE'|'LOWERCASE'|'UCFIRST'|'IGNORE'|CODE
locale => LOCALE
mode => 'NORMAL'|'VERBOSE'|'ASSERT'|'DEBUG'|0..3
Accessors
$obj->callback
Returns the code reference which will handle each logged message.
$obj->isDisabled
See "Accessors" in Log::Report::Dispatcher
$obj->mode
See "Accessors" in Log::Report::Dispatcher
$obj->name
See "Accessors" in Log::Report::Dispatcher
$obj->needs
See "Accessors" in Log::Report::Dispatcher
$obj->type
See "Accessors" in Log::Report::Dispatcher
Logging
$obj->collectLocation
Log::Report::Dispatcher::Callback->collectLocation
See "Logging" in Log::Report::Dispatcher
$obj->collectStack([MAXDEPTH])
Log::Report::Dispatcher::Callback->collectStack([MAXDEPTH])
See "Logging" in Log::Report::Dispatcher
$obj->log(HASH-of-OPTIONS, REASON, MESSAGE)
See "Logging" in Log::Report::Dispatcher
$obj->stackTraceLine(OPTIONS)
Log::Report::Dispatcher::Callback->stackTraceLine(OPTIONS)
See "Logging" in Log::Report::Dispatcher
$obj->translate(HASH-of-OPTIONS, REASON, MESSAGE)
See "Logging" in Log::Report::Dispatcher
SEE ALSO
This module is part of Log-Report distribution version 0.94, built on August 23, 2011. Website: http://perl.overmeer.net/log-report/
LICENSE
Copyrights 2007-2011 by Mark Overmeer. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See
http://www.perl.com/perl/misc/Artistic.html
perl v5.14.2 2011-08-23 Log::Report::Dispatcher::Callback(3pm)