Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Log4perl log rotation in threadpool environment ("share")

by tye (Sage)
on Nov 16, 2012 at 04:05 UTC ( [id://1004118]=note: print w/replies, xml ) Need Help??


in reply to Log4perl log rotation in threadpool environment

Use Win32API::File to open the log file with FILE_SHARE_DELETE enabled (which allows renaming while the file handle is still open) and tell Log4perl to log to that file handle.

- tye        

Replies are listed 'Best First'.
Re^2: Log4perl log rotation in threadpool environment ("share")
by rmahin (Scribe) on Nov 16, 2012 at 18:33 UTC
    Interesting! Wasn't aware ya could do that. Didnt have much luck using this due to the file handle it returned not being a typical file handle. Was able to get stuff to print, but not after I set the handle as a property of the object. Could probably get it to work if I reworked more of the code, but the post below seems to work well. Thanks for you input!

      You open a file with, for example, createFile(), and then get a "typical file handle" via OsFHandleOpen(). (Win32API::File)

      I should just submit a patch to make FILE_SHARE_DELETE be the default for Perl.

      - tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1004118]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-03-28 18:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found