geosolutions-it / DATEX-Utilities

DATEX Utilities
https://datex2.eu/
1 stars 2 forks source link

Want to extend logging from GeoServer #1

Closed simboss closed 6 years ago

simboss commented 6 years ago

Freshdesk Ticket ID: 14464
Freshdesk Ticket Agent: Support
Freshdesk Ticket Agent Email: support@geo-solutions.it
Ticket Priority: Medium
Freshdesk Ticket Description:

Hi

I'd like to customize the logging from GeoServer, specifically the log "geoserver.log".

A log entry, consists of something like the following:
2018-01-03 13:50:57,629 ERROR [geoserver.ows] - ....

I'd like to add a parameter to this log, containing a specific http header-parameter from the initiating call. This makes it possible to trace a log all the way through our infrastructure. Is this possible at all? And how would I go about doing this?

2018-01-03 13:50:57,629 ERROR [geoserver.ows] - ourguid=123123123 ....


simboss commented 6 years ago

Comment added by agent Support in Freshdesk ticket id 14464:

Hi Øyvind Arntzen Bratne,

Ticket: http://geosolutions.freshdesk.com/helpdesk/tickets/14464

Out of the box this is not possible, but it seems to be achievable by code changes.
GeoServer is still using the old Log4J 1.2.x API (a newer one, 2.x, is available, the upgrade is not trivial though) for which there was a notion of MDC, Mapped Diagnosis Context that can
be programmatically fed into Log4J:
https://veerasundar.com/blog/2009/10/log4j-mdc-mapped-diagnostic-context-what-and-why/
https://blog.f12.no/wp/2004/12/09/log4j-and-the-mapped-diagnostic-context/

Once fed into Log4J the MDC can be added into the log statements by adding a "%x{key}" into the logging pattern, controlled by the user editable logging profiles contained in the data directory, e.g.:
https://github.com/geoserver/geoserver/blob/master/data/citensg-1.0/logs/DEFAULT_LOGGING.properties

Now, if you are interested in getting this we'll have to follow a few steps:
  • We first need to spend some hours to verify with a quick prototype that this is going to work (being log4j 1.2.x unmaintained we won't have an occasion to get a fix in case there is any issue)
  • Once we have verified feasibility we can make you a firm estimate and then eventually proceed with an implementation. Right now it's not clear if this needs to be a core change or can be made into a community module, the prototype will clarify this too (e.g. a core change is available out of the box, but we'll have to go though a longer process and probably allow good configiurability of what gets into the MDC to get the change into the codebase).
Let us know if/how you want to proceed.

Best Regards
 
==
Our support, Your Success! Visit http://www.geo-solutions.it/enterprise-support-services for more information.
==
Support Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
fax:     +39 0584 1660272

simboss commented 6 years ago

Comment added by customer Øyvind Arntzen Bratne in Freshdesk ticket id 14464:

This seems like a reasonable approach. Before continuing though, can you please make a rough estimate on how many hours you will be needing for the prototyping step here as well?

Best regards

-ØB

simboss commented 6 years ago

Comment added by agent Support in Freshdesk ticket id 14464:

I estimate this prototyping work would take 4 hours

simboss commented 6 years ago

Comment added by agent Support in Freshdesk ticket id 14464:

Hi Øyvind Arntzen Bratne,

Ticket: http://geosolutions.freshdesk.com/helpdesk/tickets/14464

A quick prototype to verify feasibility and help build an estimate for the complete work would take 4 hours

Best Regards
 
==
Our support, Your Success! Visit http://www.geo-solutions.it/enterprise-support-services for more information.
==
Support Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
fax:     +39 0584 1660272

simboss commented 6 years ago

Comment added by customer Øyvind Arntzen Bratne in Freshdesk ticket id 14464:

I was sure I replied to this, however I must have replied by mail.

Please proceed with the prototyping / investigation.

Looking forward to hear about the result!

simboss commented 6 years ago

Comment added by agent Marketing Agent in Freshdesk ticket id 14464:

Hi Øyvind Arntzen Bratne,

I just reoponed it, it was closed by mistake.

Andrea will follwo up with some feedback.

Regards,

==
Our support, Your Success! Visit http://www.geo-solutions.it/enterprise-support-services for more information.
==


GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:     +39 0584 1660272



-------------------------------------------------------

simboss commented 6 years ago

Comment added by agent Support in Freshdesk ticket id 14464:

Hi Øyvind Arntzen Bratne,

Ticket: http://geosolutions.freshdesk.com/helpdesk/tickets/14464

I've managed to implement the small prototype, adding something like this in the logging configuration (note the %X{Host} ):

log4j.appender.stdout.layout.ConversionPattern=[%t] %d{dd MMM HH:mm:ss} %p [%c{2}] - %X{Host} - %m%n 
 
causes the logs to contain the HTTP request "Host" header, or an empty string if missing.

I've now inquired with the community about the best placement for this functionality, once I get an answer we'll prepare
an estimate

Best regards
Andrea

==
Our support, Your Success! Visit http://www.geo-solutions.it/enterprise-support-services for more information.
==
Support Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
fax:     +39 0584 1660272

aaime commented 6 years ago

Currently blocked waiting feedback on geoserver-devel about placement of this functionality (and minimum feature set for the community to accept it if the placement is core)

simboss commented 6 years ago

Comment added by agent Support in Freshdesk ticket id 14464:

Given the preference for putting it in core expressed on the list I would say this can be done in 8 hours (includes backports)

simboss commented 6 years ago

Comment added by agent Marketing Agent in Freshdesk ticket id 14464:

Hi Øyvind Arntzen Bratne,

given the preference for putting it in core expressed on the list I would say this can be done in 8 hours (includes backports).

Please, let us know if we should move forward with this.

Regards,

==
Our support, Your Success! Visit http://www.geo-solutions.it/enterprise-support-services for more information.
==


GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:     +39 0584 1660272



-------------------------------------------------------

simboss commented 6 years ago

Comment added by agent Support in Freshdesk ticket id 14464:

Hi Øyvind Arntzen Bratne,

Ticket: http://geosolutions.freshdesk.com/helpdesk/tickets/14464

Just a reminder that an estimate is available for you to review

Best regards
Andrea
 
==
Our support, Your Success! Visit http://www.geo-solutions.it/enterprise-support-services for more information.
==
Support Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
fax:     +39 0584 1660272

simboss commented 6 years ago

Comment added by agent Marketing Agent in Freshdesk ticket id 14464:

Hi Øyvind Arntzen Bratne,
I am going to resolve this ticket due to lack of activity.

Regards,

==
Our support, Your Success! Visit http://www.geo-solutions.it/enterprise-support-services for more information.
==


GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:     +39 0584 1660272



-------------------------------------------------------