log4cpp and odd console output - c++

I am trying to use log4cpp on my project. But everytime I try to write a log message in addition to the log message going to the log file I also get this message to the console window.
/var/log/ngis/mixer.log.3
Here is the copy of the appropriate section of my log4cpp.properties file.
# This is for the rolling file Appender, this will not send log info
# to the syslog.
log4cpp.rootCategory=INFO, rootAppender
log4cpp.appender.rootAppender=RollingFileAppender
log4cpp.appender.rootAppender.fileName=/var/log/ngis/mixer.log
log4cpp.appender.rootAppender.maxFileSize=10MB
log4cpp.appender.rootAppender.maxBackupIndex=3
log4cpp.appender.rootAppender.BufferedIO=true
log4cpp.appender.rootAppender.BufferSize=100000
log4cpp.appender.rootAppender.layout=PatternLayout
log4cpp.appender.rootAppender.layout.ConversionPattern=%d[%p %c] %m%n
The data is going to the log file. I have tried creating a file called /var/log/ngis/mixer.log.3 but that does not help.
if I change the .maxBackupIndex=3 to .maxBackupIndex=2 then the message changes to:
/var/log/ngis/mixer.log.2

Related

Spdlog: Only write to file if there is an error

At the moment I am combining a file sink with a console sink. (see bellow)
std::vector<spdlog::sink_ptr> sinks;
sinks.push_back(std::make_shared<spdlog::sinks::wincolor_stdout_sink_st>());
sinks.push_back(std::make_shared<spdlog::sinks::daily_file_sink_st>(path, 23, 59));
std::shared_ptr<class spdlog::logger> logger = std::make_shared<spdlog::logger>(name, begin(sinks), end(sinks));
I still want to log everything to the console, but only write to the file if there is an error. this is because at the moment there are a lot of useless logs and files.
You can call file_sink->set_level(spdlog::level::error) to make it log only on error and more severe levels.

Boost log output can not be redirected

I'm having trouble redirecting Boost-generated logs from the shell. We start out simply enough with an application that successfully logs to stdout.
cjholmes$ ./my_application
[2017-03-14 10:21:16.920355] [0x00007fff79497300] [info] Boost log severity set to trace
[2017-03-14 10:21:16.921071] [0x0000000101282000] [trace] Adding "/Users/cjholmes/Desktop/idsconnector/ca/DigiCertHighAssuranceEVRootCA.pem"
[2017-03-14 10:21:16.921233] [0x0000000101282000] [trace] Adding "/Users/cjholmes/Desktop/idsconnector/ca/DigiCertSHA2HighAssuranceServerCA.pem"
Easy, right? So I should be able to do this:
cjholmes$ ./my_application > log.txt
No output is sent to the console (which is expected), but when I look in the log.txt file, it is empty. The shell creates the file, but the file is always empty.
I have tried all of the usual redirection syntaxes too, and none of them work. Also, I have tried explicitly initializing the log with std::cout:
boost::log::add_console_log(std::cout);
I still get the same result. I can always get the log data on the console, but redirecting the output somehow loses all my log data.
What am I missing?

informatica is taking the source file as the indirect file

I had made a source file data type change in source analyzer. I did realize that it had made the mapping invalid. I ran the mapping and it failed. Now I reverted the change, validated the mapping, check in the mapping, validated the workflow, check in the workflow.
Now I am getting the error:
Severity Timestamp Node Thread Message Code Message
INFO 7/23/2015 10:40:03 AM node01_CSADevelopment READER_1_4_1 FR_3055 Reading input filenames from the indirect file [<input_directory_folder>/<input_file>].
Severity Timestamp Node Thread Message Code Message
ERROR 7/23/2015 10:40:03 AM node01_CSADevelopment READER_1_4_1 FR_3000 Error opening file [<input_file_folder>/<header_of_the_input_file>]. Operating system error message [No such file or directory].
here the term "input file" is the file which I wanted to load and "header_of_the_input_file" is the header of the input file.
I don't understand, why it is happening. I had just made a small change and then reverted it.
The error is just saying the filenames mentioned in the indirect file are not found. So, you just need to make sure all the source files are there in the "input_file_folder"
There is a property in the session to configure the source file as indirect. An indirect file contains a list of source filenames. Informatica reads all the files listed and loads the data. If you think you have inadvertently made the source file indirect, you can change the option in session properties (mapping tab -> Source Qualifier)
It does not have anything to do with the datatype change and reverting it.

how to print logs into only one file by google glog

I'm now using google glog. When I'm debugging the program, every time the process restart, a new log file generated, identified by the new pid as filename's sufix, like this
ied_config.20131220-142934.4524
ied_config.20131220-171227.3948
ied_config.20131225-170117.7032
ied_config.20131225-170131.5200
ied_config.20131225-171450.7820
ied_config.20131225-172336.4116
ied_config.20131225-172924.6120
ied_config.20131225-173000.2980
ied_config.20131225-173037.1960
ied_config.20131225-173144.7304
ied_config.20131226-095843.1012
smv_client.20131219-082120.7184
smv_client.20131219-162339.5508
smv_client.20131219-163055.6156
smv_client.20131219-163155.4892
smv_client.20131219-163206.5576
smv_client.20131219-163216.6340
smv_client.20131219-163236.6952
smv_client.20131219-163307.7940
smv_client.20131219-163317.4920
smv_client.20131219-163347.6556
smv_client.20131219-163408.5124
smv_client.20131219-163428.2644
smv_client.20131219-163448.6040
smv_client.20131219-163529.6948
smv_client.20131219-163539.1592
smv_client.20131219-163549.3776
smv_client.20131219-172949.5412
smv_client.20131219-173000.4180
smv_client.20131219-173010.7432
smv_client.20131220-170628.636
smv_client.20131220-170930.3904
smv_client.20131226-095841.1296
I want to join these log just into one file for each program, I can't file the configuration for the glog ,any helps?
If you want to change the name of log files, you may need to call SetLogDestination():
google::SetLogDestination(google::INFO, "/var/tmp/another_destination.INFO");
From release 0.5 on May 8, 2021
Allow a log file to be simply named "foobar.log" with no appended
string #124
google::SetLogDestination(google::INFO, "/var/tmp/another_destination.INFO");
FLAGS_timestamp_in_logfile_name = false;

Module-wise verbose logging in Google glog

I'm using Google glog for logging. I have a file in a directory with path dir/file.cc.
I want to enable verbose logging level 5 just in this file. So I export GLOG_vmodule="file=5" into the environment and then run the program. But glog still doesn't log the VLOG(5) messages in this file. Is there a problem with the way I'm setting vmodule? Can anyone give me an example of how this should be done?
As specified here in the glog documentation:
Verbose logging can be controlled from the command line on a per-module basis:
--vmodule=mapreduce=2,file=1,gfs*=3 --v=0 will:
a. Print VLOG(2) and lower messages from mapreduce.{h,cc}
b. Print VLOG(1) and lower messages from file.{h,cc}
c. Print VLOG(3) and lower messages from files prefixed with "gfs"
d. Print VLOG(0) and lower messages from elsewhere