04-21-2006
How to Redirect the error messages from Syslog file to our own Application Log File
Hello,
I am New to Unix.
I am Using HP-UX 9000 Series for my Application.
I am Currently Facing an Issue that the error messages are being written in the syslog file instead of the Application Log File. The Codes for that Syslog.h is written in Pro*C.
I want to know how to Redirect these Error Messages from the syslog Files to the Application Log Files.
Is there any Code Changes Required,If so Please send me a Sample Code so that it will be of some use for me.
Help of any kind will of Greatful to me.
With Regards,
Bala.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I am new in shell scripting.
Can anyone point out what wrong of below script.
If I want the error output to "sqlerror.log"
and database pool data output to "bulk_main.dat".
Right now, the below script, if successful execute, the data will output to
bulk_main.dat && sqlerror.log both... (7 Replies)
Discussion started by: epall
7 Replies
2. Shell Programming and Scripting
hello all,
I'm invoking the program generate-report using backticks from my perl program and redirecting the output to the log file sge-stderr.log. But when i check the process using ps command it is spawing two processes where the below code is parent process and the program generate-report as... (2 Replies)
Discussion started by: kalyanraj
2 Replies
3. Shell Programming and Scripting
Hi all,
i would like to write the shell script program, it can monitor the access_log "real time"
when the access_log writing the line contain "abcdef" the program will be "COPY" this line into a file named "abcdef.txt", do the same thing if the contain "123456" "COPY" it into a file named... (3 Replies)
Discussion started by: eric_wong_ch
3 Replies
4. Shell Programming and Scripting
I am working on a generic script that will run a shell script with the arguments passed and redirect errors to one file, and all other output to another file. Then if there is anything in the error file it emails the error to me, otherwise it exits.
The advantage for this approach is that I... (0 Replies)
Discussion started by: gandolf989
0 Replies
5. HP-UX
how to redirect the growing contents of log file to another file in unix (2 Replies)
Discussion started by: megh
2 Replies
6. Shell Programming and Scripting
Hi Everyone,
I have an issue and trying to get a solution but was not succesful yet. Any help is greatly appreciated.
I am using ksh to inoke sql loader to load data from txt file into two oracle tables based on the condition written in the control file. If an error occurs while loading into... (8 Replies)
Discussion started by: vpv0002
8 Replies
7. Shell Programming and Scripting
Hi,
My log file has error messages, universal no and universal ID. The problem is i have to search Universal ID from the error messages. But the log file write error messages with universal no and error messages in one line. and universal no with universal ID in other line. So i write two loops... (5 Replies)
Discussion started by: pjlotiya
5 Replies
8. UNIX for Dummies Questions & Answers
I have the below script, but when i execute it is still printing to screen is there a way i can stop this and just print everything to the log file. Thank you.
#!/bin/bash
exec > >(tee "/var/log/ScriptLogs/called_from_incrontab.log") 2>&1
DIR="$1"
FILE="$2"
echo "STEP 1: Datafile... (5 Replies)
Discussion started by: Ariean
5 Replies
9. UNIX for Dummies Questions & Answers
Hello All,
Server: SUSE Linux Enterprise Server 11.3 (x86_64)
Syslog-ng Version: syslog-ng 2.0.9
We have configured a Cisco router to send it's log messages to this server listed above. This has been working just perfectly
for the last couple months, but we had never setup the log... (9 Replies)
Discussion started by: mrm5102
9 Replies
10. Ubuntu
Hello to everyone! I have a question about syslog.
I want put the messages of log in a particular file
but really i don't know how to do that or i don't get the results
that I want.
I do this:
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
int main (void)
{
... (4 Replies)
Discussion started by: Kovalevski
4 Replies
LEARN ABOUT REDHAT
net::daemon::log
Net::Daemon::Log(3) User Contributed Perl Documentation Net::Daemon::Log(3)
NAME
Net::Daemon::Log - Utility functions for logging
SYNOPSIS
# Choose logging method: syslog or Win32::EventLog
$self->{'facility'} = 'mail'; # Default: Daemon
$self->{'logfile'} = undef; # Default
# Choose logging method: stderr
$self->{'logfile'} = 1;
# Choose logging method: IO handle
my $file = IO::File->new("my.log", "a");
$self->{'logfile'} = $file;
# Debugging messages (equivalent):
$self->Log('debug', "This is a debugging message");
$self->Debug("This is a debugging message");
# Error messages (equivalent):
$self->Log('err', "This is an error message");
$self->Error("This is an error message");
# Fatal error messages (implies 'die')
$self->Fatal("This is a fatal error message");
WARNING
THIS IS ALPHA SOFTWARE. It is *only* 'Alpha' because the interface (API) is not finalised. The Alpha status does not reflect code quality
or stability.
DESCRIPTION
Net::Daemon::Log is a utility class for portable logging messages. By default it uses syslog (Unix) or Win32::EventLog (Windows), but
logging messages can also be redirected to stderr or a log file.
Generic Logging
$self->Log($level, $msg, @args);
This is the generic interface. The logging level is in syslog style, thus one of the words 'debug', 'info', 'notice', 'err' or 'crit'.
You'll rarely need info and notice and I can hardly imagine a reason for crit (critical). In 95% of all cases debug and err will be
sufficient.
The logging string $msg is a format string similar to printf.
Utility methods
$self->Debug($msg, @args);
$self->Error($msg, @args);
$self->Fatal($msg, @args);
These are replacements for logging with levels debug and err. The difference between the latter two is that Fatal includes throwing a Perl
exception.
Chossing a logging target
By default logging will happen to syslog (Unix) or EventLog (Windows). However you may choose logging to stderr by setting
$self->{'logfile'} = 1;
This is required if neither of syslog and EventLog is available. An alternative option is setting
$self->{'logfile'} = $handle;
where $handle is any object supporting a print method, for example an IO::Handle object. Usually the logging target is choosen as soon as
you call $self->Log() the first time. However, you may force choosing the target by doing a
$self->OpenLog();
before calling Log the first time.
MULTITHREADING
The Multithreading capabitities of this class are depending heavily on the underlying classes Sys::Syslog, Win32::EventLog or IO::Handle.
If they are thread safe, you can well assume that this package is too. (The exception being that you should better call $self->OpenLog()
before threading.)
AUTHOR AND COPYRIGHT
Net::Daemon is Copyright (C) 1998, Jochen Wiedmann
Am Eisteich 9
72555 Metzingen
Germany
Phone: +49 7123 14887
Email: joe@ispsoft.de
All rights reserved.
You may distribute this package under the terms of either the GNU
General Public License or the Artistic License, as specified in the
Perl README file.
SEE ALSO
Net::Daemon(3), Sys::Syslog(3), Win32::EventLog(3), IO::Handle(3)
perl v5.12.1 2007-05-23 Net::Daemon::Log(3)