1.     It might depend on your OS Platform; what do you have?

2.     If your process which runs your web-service is Apache, then under which 
user-account does Apache run? In other words – it depends how your Apache is 
implemented?

3.     In my OpenVMS System Apache has it’s own account. And on yours? So my 
web-service  printf() statements deliver output to 
apache$specific:[000000]APACHE$JAKARTA_SERVER_OUTPUT.LOG

4.     AND Why should printf() go to the err output but not the out output?

5.     Using LOG – I guess he means doing something like what follows …

 

 

Have this sub to do it for you

 

axutil_env_t *

axawl_create_env_with_error_log(axis2_char_t* stream_name) {

    allocator = axutil_allocator_init(NULL);

    if (!allocator) {

        printf("\nallocator is NULL");

        return NULL;

    }

    error = axutil_error_create(allocator);

    if (!error) {

        printf("\ncannot create error");

        return NULL;

    }

    axis_log = axutil_log_create(allocator, NULL, stream_name);

    if (!axis_log) {

        printf("\ncannot create log %s", stream_name);

        return NULL;

    }

    axis_log->level = AXIS2_LOG_LEVEL_INFO;

    env = axutil_env_create_with_error_log(allocator, error, axis_log);

    if (!env) {

        printf("\ncannot create env with error and log %s", stream_name);

        return NULL;

    }

    return env;

}

 

 

In your main code call 

 

    env = axawl_create_env_with_error_log(logfilename);

    if (!env) {

        printf("\n unable to create environment variable env");

        exit(0);

    }

 

    /**

     *  The next 3 commands have a process wide character for logging

     *  you can send the logging to a file or prevent file logging

     *  and send it to standard output which is - hähä - logging to

     *  a file because this is a detached process. But logging to

     *  a standard output device such as sys$output would work when

     *  running this from its own main as an intercative process. (capito)

     **/

    log_level = getenv("AXIS2_LOG_LEVEL");

    if (!log_level) {

        printf("VMS Logical 'AXIS2_LOG_LEVEL' is not defined, using 
AXIS2_LOG_LEVEL_INFO");

            //leave it as default is ---- INFO

    } else {

        if (strcmp(log_level,"AXIS2_LOG_LEVEL_CRITICAL") == 0)

                env->log->level = AXIS2_LOG_LEVEL_CRITICAL;

        if (strcmp(log_level,"AXIS2_LOG_LEVEL_ERROR") == 0)

                env->log->level = AXIS2_LOG_LEVEL_ERROR;

        if (strcmp(log_level,"AXIS2_LOG_LEVEL_WARNING") == 0)

                env->log->level = AXIS2_LOG_LEVEL_WARNING;

        if (strcmp(log_level,"AXIS2_LOG_LEVEL_INFO") == 0)

                env->log->level = AXIS2_LOG_LEVEL_INFO;

        if (strcmp(log_level,"AXIS2_LOG_LEVEL_DEBUG") == 0)

                env->log->level = AXIS2_LOG_LEVEL_DEBUG;

        if (strcmp(log_level,"AXIS2_LOG_LEVEL_TRACE") == 0)

                env->log->level = AXIS2_LOG_LEVEL_TRACE;

    }

    log_enabled = getenv("AXIS2_LOG_ENABLED");

    if (!log_enabled){

        printf("VMS Logical 'AXIS2_LOG_ENABLED' is not defined, using 
AXIS2_LOG_ENABLED");

        // leave it as is on ---- INFO and enabled

    } else {

        if (strcmp(log_enabled,"AXIS2_TRUE") == 0)

        {

            env->log->enabled = AXIS2_TRUE;        // surpresses output to log 
file

            env->log_enabled = AXIS2_TRUE;         // surpreses creation of 
REP12.xml's

        } else {

            env->log->enabled = AXIS2_FALSE;       // surpresses output to log 
file

            env->log_enabled = AXIS2_FALSE;        // surpreses creation of 
REP12.xml's

        }

    }

 

 

Then use can use things like that

 

    AXIS2_LOG_INFO     (env->log, "\n 1. Spg-Legacy %s %d", "login() starts 
here -------", 1);

 

    AXIS2_LOG_DEBUG     (env->log, AXIS2_LOG_SI, "\n uri %s \n prefix %s", uri, 
prefix);

 

    AXIS2_LOG_DEBUG     (env->log, AXIS2_LOG_SI, "\n %s %d", 
"axawl_deserialize_input_payload() .... ", 2);

 

    if (!xml_reader) {

        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "\n %s", 
axutil_error_get_message(env->error));

 

 

 

Hope this helps

Josef.Stadelmann

@axa-winterthur.ch

 

 

Von: [email protected] [mailto:[email protected]] Im Auftrag von Sam 
Carleton
Gesendet: Montag, 31. Mai 2010 14:08
An: Apache AXIS C User List
Betreff: Where do printf's go when running under Apache?

 

I have only a few printf's in my service, which is running under Apache.  
Where, if anywhere, does the printf go?  I thought it went to the 
apacheError.log, but I am not seeing it there.

Reply via email to