@@ -203,7 +203,7 @@ static gelf_connection* log_gelf_connection_acquire(request_rec* r) {
203
203
rv = apr_reslist_acquire (config -> connection_pool , (void * * )& con );
204
204
if (rv != APR_SUCCESS || !con ) {
205
205
ap_log_rerror (APLOG_MARK , APLOG_ERR , 0 , r ,
206
- "mod_log_gelf: Failed to acquire GELF connection from pool %s" ,
206
+ "mod_log_gelf: Failed to acquire GELF connection from pool: %s" ,
207
207
apr_strerror (rv , errbuf , sizeof (errbuf )));
208
208
return NULL ;
209
209
}
@@ -237,7 +237,7 @@ static apr_status_t log_gelf_get_gelf_connection(gelf_connection *gc, gelf_confi
237
237
238
238
if (verbose > 0 ) {
239
239
ap_log_perror (APLOG_MARK , APLOG_NOTICE , 0 , pool ,
240
- "mod_log_gelf: Connecting to server %s" , config -> server );
240
+ "mod_log_gelf: Connecting to server: %s" , config -> server );
241
241
}
242
242
243
243
rv = apr_sockaddr_info_get (& gc -> sa , config -> server , APR_INET , config -> port , 0 , pool );
@@ -337,6 +337,19 @@ static apr_status_t gelf_pool_destruct(void* resource, void* params, apr_pool_t*
337
337
return APR_SUCCESS ;
338
338
}
339
339
340
+ static apr_status_t log_gelf_child_exit (void * resource ) {
341
+ apr_reslist_t * connection_pool = resource ;
342
+ apr_pool_t * pool = NULL ;
343
+ apr_pool_create (& pool , NULL );
344
+
345
+
346
+ while (apr_reslist_acquired_count (connection_pool ) != 0 ) {
347
+ ap_log_perror (APLOG_MARK , APLOG_ERR , 0 , pool ,
348
+ "mod_log_gelf: Socket pool not empty: %i" , apr_reslist_acquired_count (connection_pool ));
349
+ }
350
+ apr_reslist_destroy (connection_pool );
351
+ }
352
+
340
353
/* Registered hooks */
341
354
static int log_gelf_post_config (apr_pool_t * p , apr_pool_t * plog , apr_pool_t * ptemp , server_rec * server ) {
342
355
gelf_config * config = ap_get_module_config (server -> module_config , & log_gelf_module );
@@ -354,8 +367,10 @@ static int log_gelf_post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *pte
354
367
config -> enabled = 0 ;
355
368
return OK ;
356
369
}
370
+ // apr_pool_cleanup_register(p, config->connection_pool,
371
+ // (void*)apr_reslist_destroy, apr_pool_cleanup_null);
357
372
apr_pool_cleanup_register (p , config -> connection_pool ,
358
- ( void * ) apr_reslist_destroy , apr_pool_cleanup_null );
373
+ log_gelf_child_exit , log_gelf_child_exit );
359
374
360
375
/* allocate memory for log items */
361
376
config -> parsed_fields = apr_pcalloc (config -> parse_pool , strlen (config -> fields ) * sizeof (log_item * ));
0 commit comments