Hi All,
Log API has changed to make the logging as useful as possible to
users. Please have a look at axis2_log.h for new macro set.
There is a seperate macro for each log level.
Many thanks to Nabeel for his help to get this working.
Samisa...
Nabeel wrote:
Log levels are already defined as AXIS2_LOG_DEBUG, AXIS2_LOG_INFO,
etc. Since these enums are used in many places in the source code to
wrtie logs, I didn't want to change them with this patch.
Ideally these enums should be changed to AXIS2_LOG_LEVEL_DEBUG,
AXIS2_LOG_LEVEL_INFO, etc and as you suggested, the functions should
be changed as AXIS2_LOG_DEBUG, AXIS2_LOG_INFO, etc.
- Nabeel
Samisa Abeysinghe wrote:
This is cool. BTW, why did you use _F_ in the function macro? any
specific reason?
I would like it to read as AXIS2_LOG_DEBUG instead of AXIS2_F_LOG_DEBUG.
Thanks,
Samisa...
Nabeel wrote:
Sorry..missed the Axised prefix..
Nabeel wrote:
Hi,
log implementation is updated to have the following methods. and
these methods take variable number of arguments (work just like
printf,sprintf, etc). now you don't need to do a sprintf to create
the string and pass it to log write method. Pls review and commit
if useful.
AXIS2_F_LOG_DEBUG
AXIS2_F_LOG_INFO
AXIS2_F_LOG_ERROR
AXIS2_F_LOG_WARNING
AXIS_F_LOG_CRITICAL
(for performance reasons and convenience, instead of using a
switch, seperate methods are written for different log levels)
All these takes similar set of arguments
(log,__FILE__,__LINE__,formated string)
e.g.:
AXIS2_F_LOG_INFO(log,__FILE__,__LINE__,"my info %s %d","test",1);
this would log
[info] xxx.c(nn) my info test 1
files in the patch:
modules/util/log.c
modules/util/axis2_log_default.h
include/axis2_log.h
3 booleans are defined to independently on/off debug/info/warning
logs. (log_level parameter may be removed if we go for this scheme.
AXIS2_LOG_WRITE macro works as it used to, but prints the file name
and line number transparently.
TODO (suggestions): read log configuations from an xml file
implement AXIS2_F_LOG_XML(log obj ,xml obj, formated
string)
using a file descriptor instead of stderr (2) and
keeping previous log when the app restarts
Thanks
- Nabeel