I'm (still) attempting (in my spare time, ha-ha) to move some software off of my own custom logging solution to Log4perl.

I have need to be able to have an appender to that updates a variable within the code so I can easily display this to the user as the program runs via a Tkx label widget. I haven't been able to sort out how to do this, as the two obvious solutions (Log::Log4perl::Appender::String and read it, or Log::Log4perl::Appender with Log::Dispatch::File, and have it write to a filehandle that's a variable) don't work in any fashion that I've tried: String requires a direct call to the Appender to get it triggered, and File doesn't seem to accept anything but a scalar as an argument, so a reference to a FH seems to be a non-starter.

There seems to be the idea that you can roll your own, but the documentation in the FAQ and the few other places I've found is somewhat sparse, as there are a variety of ways to get the data that I'm wanting, that probably fits the other nearly 100% of the use cases. A more complete document (or possibly one that makes fewer assumptions about the person needing to write something of this nature) on this would possibly be sufficient, since what I'm doing is seemingly fairly simple.

The structure of L4p seems to be pretty rigid, which is kind of surprising to me: It doesn't seem to fit nicely with the idea of TIMTOWTDI. Then again, I may not be wise enough to understand the subtleties that are involved. I'm not above admitting it.


In reply to Log4perl appender to write to scalar? by jellisii2

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.