Closed aszkid closed 11 years ago
Hey,
Yup there is a way to avoid it - or more specifically to change it - this is necessary as this is the starting configuration (and then when you re-configure, it just re-assigns it)
The way you change it is macro definition during compilation or above #include "easylogging++.h"
Macro name is _ELPP_DEFAULT_LOG_FILE
and value will be filepath you want, (may be /tmp/my-tmp-file.log
?) Have a look at the last macro on Configuration Macros section.
PLease let me know if you can think of any alternative way of implementation :)
EDIT: And you have typo in DEBUG date format, i think you need %m
:) instead of %n
hope this helps
I have come up with a solution to this and will implement this in v9.13
Fixed in v9.13 :) - look for macro name _ELPP_NO_DEFAULT_LOG_FILE
in Configuration Macros section of manual
feel free to check out release notes for v9.12 (released yesterday) and v9.13
Thanks for you attention and the feature addition, but i'm getting an assertion with the expression 'map/set iterator not dereferencable' right when the debugger steps over _INITIALIZE_EASYLOGGINGPP. Something's wrong, because if i remove the definition of the macro _ELPP_NO_DEFAULT_LOG_FILE, it works, but it (obviously) creates the folder and log file.
I'll spend some time and go over the easylogging file, to see if i can help to correct bugs as i encounter them. Thanks a lot for your hard work!
All good :)
Sorry about that, try v9.14 and let me know if this issue is still there - currently i am travelling so I cant test on my windows machine
Also if you are worried about compile warnings - they have been fixed in v9.15
Confirmed - its working with VC++ (and other compilers) provided you dont try to log before configuration
Ugh, then i'm doing something wrong, because with 9.16 i still get that assertion error:
I retried with the code in your screenshot and my guess is your configuration file path is not correct- please find two attachments, one with invalid path where i do get assertion failure (as expected because I am trying to write to file that does not yet exist hence not pointer to it is not derefernecable) and other with correct configuration path which works good
Try it with fully qualified path
or alternatively using
el::Loggers::reconfigureAllLoggers(el::ConfigurationType::Filename, "../my.log");
before you start logging anything including CHECK
macros
I tried relative path and it works for me as well - e.g, in VC++ sample \samples\VC++\VCPP2012_Win32_Multithreaded
I put my configuration file there and used same relative path as yours with my file conf.txt
and its logging to correct place and picking up from correct place
I think to be on safe side always use
el::Loggers::reconfigureAllLoggers(el::ConfigurationType::Filename, "../my.log");
before trying to configure using configuration file, that way you will always know if it can't find configuratoin file - it will log to my.log
anyway
I have created issue https://github.com/easylogging/easyloggingpp/issues/102 for v9.17 release
This is weird:
If i take the NO_DEFAULT_LOG_FILE macro out, it works.
Well it is weird. Can u plz make sure u have at least v9.15 if not any higher? You can see it from top of header file
And one more thinn u have braces around easylogging ++ header which means the preferred search path is include path. Can u plz make sure when u look for version u look at correct file thst vs2012 is picking up
I've been playing around and have noticed that, no matter if my configuration specifically defines a file as follows:
A folder 'logs' and empty file 'myeasylog.log' is made (inside the folder). Is that supposed to happen? Is there any way to avoid the creation of the folder and file?