So I'm trying to log what's happening in a certain subroutine in a certain module.

The module and sub definitely are being called because if I add die() to it, the system dies at the right point.

I'm probably trying to do something naive but I'm adding this to the module:

open(LOG,'>>','/var/log/customl.log') or die "can't open log";

To the module (in a BEGIN block or by itself), and it doesn't die, but it doesn't print anything to that log.

Then I put something like this in the key subroutine:

print LOG "Config is $config" or die $!;

And again, it doesn't die but it doesn't print.

I know this idea is probably very blunt force but there's no built-in logger for this system and I need to know what's happening in a complex web app.

Is it because this is on CentOS and it has extra security contexts which prevent me writing to that file? In that case, why doesn't it die? And how can I make it writeable? It can be anywhere, it doesn't have to be in /var/log

Thanks in advance


In reply to Why can't I write to a custom log from a Catalyst application on SELinux/CentOS by Cody Fendant

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.