Is there a file descriptor created for logfile using by logmsg within Perl script
We have a log file which is updated by one Perl script using logmsg. But I find nothing when I am using lsof|grep logfile to try to find out the process id. Actually I already know which process but I also did not find this logfile descriptor in /proc/processid/fd. Why? What is the right way to find out this process ?
LinuxPerl
Last Comment
Suhas .
8/22/2022 - Mon
ozo
How is logmsg defined?
c11v11
ASKER
sub logmsg {
my ($msg) = @_;
my $LOG = new IO::File::fcntl("$logFile",'a','lock_ex') or warn "$!";
my $DateTime = strftime "%b %e %Y %T", localtime;
if ($LOG) {
print $LOG "$DateTime,$msg";
print "$DateTime,$msg" if (! $daemon);
close $LOG;
}
}
How can I get the $LOG value? Is this the value for file descriptor?
If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.