Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning: close() on unopened filehandle FH at Log/Log4perl/Appender/File.pm line 257 during global destruction. #27

Closed
cvee opened this issue May 10, 2013 · 2 comments

Comments

@cvee
Copy link

cvee commented May 10, 2013

Using Log4Perl 1.40 with Perl 5.16.2 results in the warning:

"close() on unopened filehandle FH at Log/Log4perl/Appender/File.pm line 257 during global destruction."

According to the Perl 5.16.2 documentation for perlobj:
"If your DESTROY method issues a warning during global destruction, the Perl interpreter will append the string " during global destruction" the warning."

It appears the global destruction phase in Perl automatically closes open file handles causing the DESTROY method to output the warning when it attempts to close the file handle.

@mschilli
Copy link
Owner

Can you post your code? Looks like the problem isn't that the cleanup happens in the global destruction phase (this is normal if, e.g., you're using a logger that doesn't go out of scope until the program ends by declaring it via "our"), but that it tries to close an unopened file handle, which happens, e.g. if you've already closed it manually or if it's a subprocess and the handle has already been closed in the parent process.

@mschilli
Copy link
Owner

closed due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants