I want to be able to output the currently loaded config filename, is this possible?
I want to basically write out a log entry with the config filename so I know which config file loaded just to verify things.
Related
I tried to set up new configs for my postgres, but for some reason I can't do it correctly.
First of my trying is to move .pid file to some other location, I can rename the file in postgres.conf but I can't set it to directory I need.
Same situation is with .log file.
Why when I tried to set pid file using external_pid_file = '/home/vagrant/shared/pids/postgres.pid' file isn't created? Or when I tried to set log file to /home/vagrant/shared/logs folder I have the same issue.
My config file:
https://pastebin.com/ud6HSJrn
When getting a remote ftp file that exists in the local destination
ncftpget says that
local file appears to be the same as the remote file, download is not necessary.
What does appears mean? How does ncftpget check if this is the same file?
It seems that it compares time and size of the file. But does it compare content or at least checksum?
Is there a way to force to overwrite the existing file. Of course other than remove it first.
I want to see files in my localhost directory using Kitura.
I've written:
router.all("/test/*", middleware: StaticFileServer())
but it didn't seem to work
I want to all files in my directory. Similar to directoryIndex
You can pass the path to a directory to serve to StaticFileServer, as path parameter, by default it is "public":
router.all("/test/", middleware: StaticFileServer(path: "MyDirectoryWithStaticFiles"))
Then you will be able to access the files in this directory, but not the directory itself. E.g., you will be able to perform GET /test/someFile.html, but not /test/. You will be able to GET /test/, if your directory will contain index.html.
See https://github.com/IBM-Swift/Kitura-Sample for example of using StaticFileHandler.
In nxlog config I have these params set:
SavePos True
ReadFromLast True
When removing lines from a log file (this should never happen) nxlog ships the entire log file. Is this related to how nxlog tracks the line number?
To recreate:
I stop the nxlog service
Delete the nxlog cache (just to make sure im starting fresh)
Right now the log folder ive configured nxlog to watch is empty
I add a new log file to the folder
nxlog ships the log file
I open the log file and add a few lines
nxlog ships those lines
I delete those new lines I just added
nxlog ships the entire log file
NXLog and generally other log shippers are designed to deal with append-only log files.
When you delete lines from the log file it sees that the file size is less. Under the append-only assumption this can only mean that the file was replaced/rotated and the current file is a new one that needs to be fully read.
Also note that when you edit a log file in a text editor the editor will usually replace the file with a new one even if you only append data to the end. This is not equivalent to echo test >> test.log.
If you want to transfer all kinds of changes in files you should use rsync or other tools.
I am having a configuration INI file to store all configuration required for my script to run. I have a Logger.PM which uses Log4Perl, and ConfigReader.PM which reads the INI file and stores the value in global variable. My Start.PL is the entry point where i call the methods from Logger and configreader.
What I do currently
In Start.PL I hardcoded the INI file path
In Logger.Pm I harcoded the directory name where log files should be stored
What I want
I want the INI file path as configurable
I want the log folder path to be taken from the INI file
I could do this by following
Pass the INI file path as a parameter to the start.pl
Read the INI file and get the folder path from INI file
What I could face is that
I cannot use the Logger.PM in ConfigReader (partially) since the
folder name required for logger is part of INI file
I want to log every step of my script (for logging/debugging purpose in case of failure. )
I can use print but this will write to console and to capture i need to use >>log.txt. Then i will be forced to maintain 2 logs for my application which is not what I wanted
Anyone have a good solution for this scenario?
You can pass INI file path in command line using Getopt::Long, and command line switches for istance:
Start.pl --ini=/path/to/INI_file
Here is a code sample to show what changes are needed in Start.pl, in order to have switches:
#!/usr/bin/env perl
use v5.12;
use strict;
use Getopt::Long;
# That little tiny 's' after 'ini=' is for string
GetOptions ( 'ini=s' => \my $ini_file );
say $ini_file;
After this change, you can read all options from your INI file, including log folder path ( are you already using a module to manage INI files like Config::IniFiles? ).
There is something still unclear in your question about print: although one of my master said that print with a pair of square brackets is the best debugger in the world, why use print when you have set up Log::Log4perl?
When you say that Logger.PL can't be used in ConfigReader, are you referring to the log object?