GeoServer

Add User-Agent logging to Monitoring extension

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 2.1.3, 2.2.x
  • Component/s: Community modules
  • Labels:
    None
  • Number of attachments :
    3

Description

The monitoring extension currently does not support the logging of user agents. This patch adds user agent recording in the logs.

  1. user-agent-monitoring.diff
    23/Nov/11 8:31 PM
    3 kB
    Tony Young
  2. user-agent-monitoring.diff
    23/Nov/11 8:31 PM
    21 kB
    Tony Young
  3. user-agent-monitoring.diff
    23/Nov/11 6:34 PM
    21 kB
    Tony Young

Activity

Hide
Tony Young added a comment -

Sorry about that, accidentally added my IDE files.

Show
Tony Young added a comment - Sorry about that, accidentally added my IDE files.
Hide
Justin Deoliveira added a comment -

Hi Tony,

Thanks for the patch. Looks good to me.

This actually gives us a chance to try something out I have been curious about, and that is how hibernate deals with schema changes. Currently the hibernate config with monitoring is set to update the schema when the mappings change, but i am curious to know how this works. So, question, have you tried this? Going from a database created with the pre user agent version, and then restarting it with the useragent change applied? I imagine just adding a column will probably work ok.

Show
Justin Deoliveira added a comment - Hi Tony, Thanks for the patch. Looks good to me. This actually gives us a chance to try something out I have been curious about, and that is how hibernate deals with schema changes. Currently the hibernate config with monitoring is set to update the schema when the mappings change, but i am curious to know how this works. So, question, have you tried this? Going from a database created with the pre user agent version, and then restarting it with the useragent change applied? I imagine just adding a column will probably work ok.
Hide
Tony Young added a comment -

Hi Justin,

I've checked the database generated and, with the H2 backend, Hibernate seems to be capable of automatically performing a migration to add the user agent column. I cannot get it to work with other database backends, such as PostgreSQL, and therefore I haven't been able to verify if Hibernate can migrate those.

Show
Tony Young added a comment - Hi Justin, I've checked the database generated and, with the H2 backend, Hibernate seems to be capable of automatically performing a migration to add the user agent column. I cannot get it to work with other database backends, such as PostgreSQL, and therefore I haven't been able to verify if Hibernate can migrate those.
Hide
Justin Deoliveira added a comment -

Hi Tony,

Do you mean you can't get the monitoring extension to work at all with postgres? It should be a matter of just changing the two config files, db.properties and hibernate.properties. db.properties should look something like:

driver=org.postgresql.Driver
url=jdbc:postgresql://<host>:<port>/<datbase>
username=<username>
password=<password>
defaultAutoCommit=false

In hibernate.properties you have to change two parameters:

#databasePlatform=org.geoserver.monitor.hib.H2Dialect
databasePlatform=org.hibernate.dialect.PostgreSQLDialect
#database=H2
database=POSTGRESQL
Show
Justin Deoliveira added a comment - Hi Tony, Do you mean you can't get the monitoring extension to work at all with postgres? It should be a matter of just changing the two config files, db.properties and hibernate.properties. db.properties should look something like:
driver=org.postgresql.Driver
url=jdbc:postgresql://<host>:<port>/<datbase>
username=<username>
password=<password>
defaultAutoCommit=false
In hibernate.properties you have to change two parameters:
#databasePlatform=org.geoserver.monitor.hib.H2Dialect
databasePlatform=org.hibernate.dialect.PostgreSQLDialect
#database=H2
database=POSTGRESQL
Hide
Tony Young added a comment -

Hi Justin,

Seems like i forgot to change the Hibernate dialect — it works fine on PostgreSQL as well by adding a user_agent column onto the end of the table when migrating.

Show
Tony Young added a comment - Hi Justin, Seems like i forgot to change the Hibernate dialect — it works fine on PostgreSQL as well by adding a user_agent column onto the end of the table when migrating.
Hide
Justin Deoliveira added a comment -

Patch applied. Thanks Tony!

Show
Justin Deoliveira added a comment - Patch applied. Thanks Tony!
Hide
Andrea Aime added a comment -

Mass transition all resolved issue that did not see any further comment in the last month to closed status

Show
Andrea Aime added a comment - Mass transition all resolved issue that did not see any further comment in the last month to closed status

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: