http://www.perlmonks.org?node_id=497414


in reply to tfmail_application error_bad logfile name

Based on what the error message says, your full "TFmail.pl" script is over 1000 lines long (the error occurs at line 1048 in that script) -- so I guess it's just as well that you don't try to show us the whole script.

Still, we can't answer your question without knowing what some of your perl code looks like, especially the part that includes line 1048 in that file. The message says you are trying to use a bad logfile name, and it looks like the value you have for the file name may be an empty string, or something that is not a visible character (e.g. space, tab, carriage-return or line-feed, or some control-character maybe).

Your config data shows that you have a directory path and a file name extension for the log file. So how are you setting the actual file name (the part that goes between the path and the extension)? Is this being stored in a scalar variable? How/where is that scalar value set in your code?

Look at line 1048 in your script, figure out how the log file name is being supplied there, and then, if it's a scalar variable that is supposed to be holding the file name, search around in the script to see whether a value is being assigned to that variable. If you find that, show us the relevant parts of the code (just the parts that determine how the file name is assigned). If you don't find it, that's probably the root cause of the problem -- a file name value needs to be provided.

I don't think this has anything at all to do with using Notepad to create an initial log file. Don't worry about that. The logging process should create the file if it does not exist, and append to it when it does exist.

  • Comment on Re: tfmail_application error_bad logfile name

Replies are listed 'Best First'.
Re^2: tfmail_application error_bad logfile name
by PodMaster (Abbot) on Oct 05, 2005 at 01:05 UTC
    Just for the record, tfmail comes from http://nms-cgi.sourceforge.net/, and the support page is here.

    You can see it TFmail.pl here.

    Apparently the logfile name comes from a config file.

    From the error message it looks like the OP has chosen a space as the logfile name, which apparently isn't allowed (as you can see, the error message isn't exactly cryptic).

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Re^2: tfmail_application error_bad logfile name
by Anonymous Monk on Dec 09, 2016 at 07:51 UTC

    Hi

    In the process of installing and configurring the tfmail, i have come accross this error that i dont know how to correct:

    An error has occurred in the program bad logfile name [ ] at /home/actercoa/safefoodkenya.com/cgi-bin/TFmai +l.pl line 1048. My TFmail.pl line 1048- 1053 looks like this: my $file = $treq->config('logfile', ''); $file = $treq->process_template("\%$file",'email', undef); return unless $file; $file =~ m#^([\/\-\w]{1,100})$# or die "bad logfile name [$file]"; $file = $1; open LOG, ">>@{[ LOGFILE_ROOT ]}/$file@{[ LOGFILE_EXT ]}" or die "o +pen [$file]: $!"; flock LOG, LOCK_EX or die "flock [$file]: $!"; seek LOG, 0, 2 or die "seek to end of [$file]: $!";

    Kindly assist me to resolve this.

    Kindest regards

    Jared Otieno

      The error message is bad logfile name, so most likely you configured the logfile name in a way that is incompatible with the permissions on your machine.

      Which is the same error that was already discussed in the three preceeding posts in this thread.

      What steps have you taken to ensure that your situation is different from the situation posted previously? Where did you encounter problems?