-
-
Notifications
You must be signed in to change notification settings - Fork 921
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
_ELPP_NO_DEFAULT_LOG_FILE weird behaviour #109
Comments
You are saying "NO DEFAULT LOG FILE" and then not specifying log file - where do you expect it to log to? see this sample to specify log file or configure using el::Configurations c;
c.setGlobally(ConfigurationType::Filename, "YourLogFile.log");
el::Loggers::setDefaultConfigurations(c); Closing this! |
mkhan3189, thank you for very fast reply! Unfortunately given below code still creates .\logs\myeasylog.log and doesn't create .\YourLogFile.log #define _ELPP_NO_DEFAULT_LOG_FILE int main(void) {
} |
Hey bballer, Try this (second argument of #define _ELPP_NO_DEFAULT_LOG_FILE
#include "easylogging++.h"
_INITIALIZE_EASYLOGGINGPP
int main(void) {
el::Configurations c;
c.setGlobally(el::ConfigurationType::Filename, "YourLogFile.log");
el::Loggers::setDefaultConfigurations(c, true);
LOG(INFO) << "Logging after configured!";
return 0;
} I removed existing logs\myeasylog.log file (to be sure on whats going on) and then ran above code and worked like charm! created file |
I deleted \logs\myeasylog.log, added second argument and ran the code. It has created \logs\myeasylog.log with 0 size and YourLogFile.log which finally has written the message "12/08/2013 03:10:32,381 INFO [default] Logging after configured!". Is there any way to avoid the creation of default log file? |
it's weird, i have tried several times and i dont get this file created (since I have |
I deleted the easylogging++.h from project's directory, tried to build the project and it showed that easylogging++.h file is missing. Then I downloaded the latest version of the library and built the project without any errors. When I ran the executable it created .\logs\myeasylog.log again and .\YourLogFile.log. Is there any idea how to trace that "wrong" branch of the code? |
I need to say that when I put breakpoint at the very first line in main() function the .\log\ directory is already created. So I guess that is is something in initialization of the Storage object, i.e. m_registeredLoggers->get(std::string(base::consts::kDefaultLoggerId)); |
ok try searching for look at first line to find out which version is it? |
// |
The most weird thing I found is following: when I put breakpoint at setGlobally(...) it stops there, so nevertheless the macro IS defined it continues to initialize library like without _ELPP_NO_DEFAULT_LOG_FILE macro #if !defined(_ELPP_NO_DEFAULT_LOG_FILE) |
i can only think the macro namme issue - i would suggest instead of using |
Will try, thanks for advice. And thanks for the great lib! |
I got the same problem, and the root cause is that the file is being created when you call:
So it will always create the default ./logs/myeasylog.log. |
Also worth noticing it's not |
In version 9.80 _ELPP_NO_DEFAULT_LOG_FILE changed to ELPP_NO_DEFAULT_LOG_FILE. |
Given below code doesn't show any mistake and creates .\logs\myeasylog.log file. Using VC2012.
define _ELPP_NO_DEFAULT_LOG_FILE
include "easylogging++.h"
_INITIALIZE_EASYLOGGINGPP
int main(void)
{
LOG(INFO) << "Logging after configured!";
return 0;
}
The text was updated successfully, but these errors were encountered: