I have this problem with Axis2 C logging system where I work with a branch of Axis2 C for the project I’m currently working on. In this project I have several services deployed in Axis2C. While developing these complex services I put whole lot of debugging log messages to track the development process. My problem is that when axis2c engine is started with log level of debug it prints whole bunch of engine/transport related debug messages so that my debug messages of the service which are my current interest are obscured. It is true that the engine/transport related debug messages are of importance but at this level of my debugging I can safely assume that engine/transport workes as intended and stable I have no interest in debugging them. My only interest is seeing the log messages clearly for the service I’m developing now.
In one of my services I periodically send soap messess reusing a service client. For each message I send, there are hundereds lines of repeated messages from engine/transport. Not only that, because of this within few minutes the files size become several megabytes.
The unlimited growth of log file without any log rotating mechanism is another issue for which I have put an jira proposing a simple log rotating mechanism for it.
When I discussed this issue with Dinesh he suggested that this should be handled at service level, may be by editing and inserting a parameter in services.xml. The solution I have provided below is not exactly that but his idea of handling at service level is taken.
I have provided a soultion for the problem at hand in the axis2c branch using for the project. It is to provide another logging function in addition to the existing set
The new logging function is AXIS2_LOG_SERVICE()
This function can be called from the service code you are writing. Then you can start the axis2c engine with the new log level AXIS2_LOG_LEVE_SERVICE. Then you will find that only the critical/errors from the engine/transport are printed to the log file and all the messages you put as AXIS2_LOG_SERVICE are also printed. Now it is very useful because you can easily highlight the problems at hand.
So suppose your service have following log messages
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, “Error log message”);
AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, “Debug log message”);
AXIS2_LOG_SERVICE(env->log, AXIS2_LOG_SI, “Custom Service Log”);
Now can you guess what messages are printed and when?
Answer is when started the sever with run level AXIS2_LOG_LEVEL_SERVICE only error/critical and service messages are printed, not the debug level log messages from engine/transport.
If you start the service with log leve debug then all the messages are printed.
Simple solution which save lot of energy right?
One other thing that is needed to make logging with axis2c fun is the ability to plug in some other logging mechanisms to Axis2C. For example I have a requirement in my project to log critical errors to syslog while printing other levels to axis2c log. I’m thinking how can this be solved immediately.