diff --git a/examples/server_loglevel.c b/examples/server_loglevel.c index 5b433d25a65..39083b37345 100644 --- a/examples/server_loglevel.c +++ b/examples/server_loglevel.c @@ -46,12 +46,15 @@ int main(int argc, char **argv) { } #endif - UA_Logger logger = UA_Log_Stdout_withLevel( log_level ); UA_Server *server = UA_Server_new(); UA_ServerConfig *config = UA_Server_getConfig(server); UA_ServerConfig_setDefault(config); - config->logging = &logger; + + /* Exchange the logger */ + UA_Logger logger = UA_Log_Stdout_withLevel( log_level ); + logger.clear = config->logging->clear; + *config->logging = logger; /* Some data */ UA_StatusCode retval;