Skip Menu |

This queue is for tickets about the CPAN CPAN distribution.

Report information
The Basics
Id: 118921
Status: resolved
Priority: 0/
Queue: CPAN

People
Owner: Nobody in particular
Requestors: CHORNY [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: 2.22



Subject: error is not printed if Log::Log4perl is not installed
CPAN 2.14_01 (bundled with perl 5.25.7) without Log::Log4perl: C:\>cpan BBB/File-NFSLock-1.21.tar.gz Loading internal null logger. Install Log::Log4perl for logging messages CPAN: Storable loaded ok (v2.59) Reading 'C:\STRAWB~1\cpan\Metadata' Database was generated on Wed, 23 Nov 2016 09:41:02 GMT with Log::Log4perl: C:\>cpan BBB/File-NFSLock-1.21.tar.gz CPAN: CPAN::SQLite loaded ok (v0.211) Database was generated on Wed, 23 Nov 2016 12:10:17 GMT Could not expand [BBB/File-NFSLock-1.21.tar.gz]. Check the module name. I can suggest names if you install one of Text::Levenshtein::XS, Text::Levenshte in::Damerau::XS, Text::Levenshtein, and Text::Levenshtein::Damerau::PP Skipping BBB/File-NFSLock-1.21.tar.gz because I couldn't find a matching namespa ce. -- Alexandr Ciornii, http://chorny.net
Subject: Re: [rt.cpan.org #118921] error is not printed if Log::Log4perl is not installed
Date: Wed, 23 Nov 2016 17:52:46 -0500
To: "bug-CPAN [...] rt.cpan.org" <bug-CPAN [...] rt.cpan.org>
From: brian d foy <brian.d.foy [...] gmail.com>
I can reproduce this. The null logger in App::Cpan is just that. It doesn't do anything. All the methods are picked up by AUTOLOAD, which does nothing. It would be easy to make error() (and other) method to simply print to STDERR. I have a couple of open pull requests into CPAN.pm already though... ;)
Subject: Re: [rt.cpan.org #118921] error is not printed if Log::Log4perl is not installed
Date: Thu, 24 Nov 2016 03:50:17 +0100
To: "brian d foy via RT" <bug-CPAN [...] rt.cpan.org>
From: Andreas Koenig <andreas.koenig.7os6VVqR [...] franz.ak.mind.de>
Show quoted text
>>>>> On Wed, 23 Nov 2016 17:53:36 -0500, "brian d foy via RT" <bug-CPAN@rt.cpan.org> said:
Show quoted text
> Queue: CPAN > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=118921 >
Show quoted text
> I can reproduce this.
Show quoted text
> The null logger in App::Cpan is just that. It doesn't do anything. All > the methods are picked up by AUTOLOAD, which does nothing. It would be > easy to make error() (and other) method to simply print to STDERR.
Show quoted text
> I have a couple of open pull requests into CPAN.pm already though... ;)
Thanks for looking into it. I think I would gladly apply any fixes that do not interfere with those things that block 5.22.3 and 5.24.1. Let me know which of your pull requests you would like to see applied now and I will revisit them. Thanks, -- andreas
CC: undisclosed-recipients:;
Subject: Re: [rt.cpan.org #118921] error is not printed if Log::Log4perl is not installed
Date: Thu, 24 Nov 2016 03:49:59 +0100
To: "brian d foy via RT" <bug-CPAN [...] rt.cpan.org>
From: Andreas Koenig <andreas.koenig.7os6VVqR [...] franz.ak.mind.de>
Show quoted text
>>>>> On Wed, 23 Nov 2016 17:53:36 -0500, "brian d foy via RT" <bug-CPAN@rt.cpan.org> said:
Show quoted text
> Queue: CPAN > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=118921 >
Show quoted text
> I can reproduce this.
Show quoted text
> The null logger in App::Cpan is just that. It doesn't do anything. All > the methods are picked up by AUTOLOAD, which does nothing. It would be > easy to make error() (and other) method to simply print to STDERR.
Show quoted text
> I have a couple of open pull requests into CPAN.pm already though... ;)
Thanks for looking into it. I think I would gladly apply any fixes that do not interfere with those things that block 5.22.3 and 5.24.1. Let me know which of your pull requests you would like to see applied now and I will revisit them. Thanks, -- andreas
Subject: Re: [rt.cpan.org #118921] error is not printed if Log::Log4perl is not installed
Date: Wed, 23 Nov 2016 22:25:39 -0500
To: "bug-CPAN [...] rt.cpan.org" <bug-CPAN [...] rt.cpan.org>
From: brian d foy <brian.d.foy [...] gmail.com>
I'll make a new branch off what you have now and do something, but not before next week. If someone else wants to do it and test it, I was thinking something like this near the AUTOLOAD statement: sub error { shift; print join "\n", @_ } Do that for all the message methods called on $logger in App::Cpan.
Subject: Re: [rt.cpan.org #118921] error is not printed if Log::Log4perl is not installed
Date: Mon, 17 Jul 2017 20:38:56 +0100
To: bug-CPAN [...] rt.cpan.org
From: Zefram <zefram [...] fysh.org>
Additional opinion on this issue: reporting errors is not an optional feature. Reporting them *via a fancy mechanism* may be optional, and verbose logging may be optional, but in the absence of the optional fancy module there has to be a fallback that performs basic error reporting, i.e., sending error messages to stderr. Sending error messages to stderr also needs to be the default behaviour when the fancy module *is* installed. I've never used Log4perl, so don't know what its default is. But the default behaviour of App::Cpan needs to be the basic conventional one. If, perchance, Log4perl defaults to something else, installing the Log::Log4perl module (presumably to use in one's own project) still doesn't indicate a desire to significantly change App::Cpan's behaviour. (Small differences in the appearance of the error messages based on whether Log4perl is installed would be OK, provided that they're comprehensible and sent to stderr in either case. A side issue: I have an automated process which pipes a command into the CPAN shell and redirects stdout to /dev/null, and it's run into a problem relating to Log4perl. The intent of the redirection is that it'll suppress all of CPAN's usual chatter (which goes to stdout) but still show any reports of actual errors (to stderr). With the current version of CPAN, it shows the "Loading internal null logger" message if Log4perl is not installed. Until I found this ticket I was thinking that I would report this as a bug: that part of the chatter, of no real significance, was going to stderr, making it impossible to get a clean errors-only output. With the understanding from this ticket that the message really does indicate a problem (that some later error messages will be dropped), that complaint would not be correct in this case. It turns out that "Loading internal null logger" is actually a genuine error message, albeit with two problems. Firstly, it's not at all clear: it looks like irrelevant chatter, but should say something like "will be unable to output error messages later on", expressing the real impact of the situation. Secondly, tying into the above point about error output being an essential feature, the error condition of losing that necessary capability ought to be taken more seriously: if Log4perl is the only way to get error output then it should be a mandatory module, with failure to load it causing App::Cpan to abort. -zefram
Subject: Re: [rt.cpan.org #118921] error is not printed if Log::Log4perl is not installed
Date: Mon, 17 Jul 2017 20:00:23 -0400
To: "bug-CPAN [...] rt.cpan.org" <bug-CPAN [...] rt.cpan.org>
From: brian d foy <brian.d.foy [...] gmail.com>
Users get the error messages they need to see. Developers often want more output. It's not an essential feature. The null logger message shows up as a way to let developers know that they have a way to get enhanced output. I suppose that one message can go to standard output. If that's the change you'd like, I have no problem with that. For all the other stuff, I wouldn't want something that suddenly gave everyone output they didn't want.
Apparently I read OP differently than you. Let me paraphrase it to (hopefully) get the point across: enduser runs into a severe error that leads to cpan failing to do anything and diagnostics not providing a clue due to missing Log4perl. Such a behaviour is indeed undesired. It looks like effectively Log4perl became a hard requirement at some point in time. We either must push this requirement through for all users of CPAN.pm or reconsider the implementation. Or maybe both. I think that Zefram provides valuable advise how to proceed.
Subject: Re: [rt.cpan.org #118921] error is not printed if Log::Log4perl is not installed
Date: Tue, 18 Jul 2017 13:09:37 +0000
To: bug-CPAN [...] rt.cpan.org
From: brian d foy <bdfoy [...] cpan.org>
I understood the original post. If you would like something different than the extra feature I provided (and which I think will be more work than you imagine), I'm not going to stand in the way of the change. -- brian d foy <brian.d.foy@gmail.com> http://www.pair.com/~comdog/
RT-Send-CC: zefram [...] fysh.org, bdfoy [...] cpan.org
I just pushed d254a2c2 which I think resolves both the lost error messages and the STDOUT/STDERR issue.