Enabling Service Level Custom Logs
----------------------------------
Key: AXIS2C-734
URL: https://issues.apache.org/jira/browse/AXIS2C-734
Project: Axis2-C
Issue Type: New Feature
Reporter: Damitha Kumarage
A service developer may be interested only in the debug messages he put in his
service. He don't need all the debug messages from within the core/transport of
the axis2c engine. Currently what happen is when the axis2c engine is started
with log enabled all the log messages core/transport are printed to the log
file so that service developers log messages are obscured.
To avoid that I propose another log level called AXIS2_LOG_LEVEL_SERVICE.
When the axis2c engine is started with this log level only the critical and
error logs are printed from the core/ trasport.
All the log messages written by the service developer with the logging function
AXIS2_LOG_SERVICE( ) are also be printed.
Also If we start the axis2c engine with the log level debug, the messages
written using AXIS2_LOG_SERVICE( ) are printed. If we start the axis2c engine
with the log level critical or error only the error/critical log messages are
printed.
The function that I have added to the log.c to implement this is
AXIS2_EXTERN void AXIS2_CALL
axutil_log_impl_log_service(
axutil_log_t * log,
const axis2_char_t * filename,
const int linenumber,
const axis2_char_t * format,
...)
{
FILE *fd = NULL;
axutil_thread_mutex_t *mutex = NULL;
if (log && format)
{
if (!(fd = AXIS2_INTF_TO_IMPL(log)->stream))
{
fprintf(stderr, "Stream is not found\n");
}
if (!(mutex = AXIS2_INTF_TO_IMPL(log)->mutex))
{
fprintf(stderr, "Log mutex is not found\n");
}
if (AXIS2_LOG_LEVEL_DEBUG <= log->level)
{
char value[AXIS2_LEN_VALUE + 1];
va_list ap;
va_start(ap, format);
AXIS2_VSNPRINTF(value, AXIS2_LEN_VALUE, format, ap);
va_end(ap);
axutil_log_impl_write_to_file(log, mutex, AXIS2_LOG_LEVEL_DEBUG,
filename, linenumber, value);
}
}
else
fprintf(stderr, "please check your log and buffer");
}
Also in the other log functions I have changed this line
if (AXIS2_LOG_LEVEL_DEBUG <= log->level)
to
if (AXIS2_LOG_LEVEL_DEBUG <= log->level &&
log->level != AXIS2_LOG_LEVEL_SERVICE)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]