Skip to content

Conversation

@mazadegan
Copy link

Description:

This PR replaces the existing timbre-based logging with telemere.

The following changes were made:

  1. Replaced timbre with telemere in the deps.edn file
  2. Modified the info, warn, and error macros in src/dvb/server/log.clj to work with telemere
  3. Replaced existing logging-to-file logic with telemere's built in handler:file
  4. Added telemere-slf4j and updated slf4j-api to 2.0.13 to route slf4j logs to telemere, which doesn't have slf4j support by default.

Reason for change:

This change addresses part of an open item in the projects board.

Testing:

Comparison of startup log output with previous and new system:

Previous logs:

2025-04-28T21:38:49.275Z Maleks-MacBook-Pro.local INFO [com.zaxxer.hikari.HikariDataSource:80] - dativebase-pool - Starting...
2025-04-28T21:38:49.355Z Maleks-MacBook-Pro.local INFO [com.zaxxer.hikari.pool.HikariPool:565] - dativebase-pool - Added connection org.postgresql.jdbc.PgConnection@7c465f15
2025-04-28T21:38:49.357Z Maleks-MacBook-Pro.local INFO [com.zaxxer.hikari.HikariDataSource:82] - dativebase-pool - Start completed.
2025-04-28T21:38:49.390Z Maleks-MacBook-Pro.local INFO [org.eclipse.jetty.server.Server:375] - jetty-9.4.48.v20220622; built: 2022-06-21T20:42:25.880Z; git: 6b67c5719d1f4371b33655ff2d047d24e171e49a; jvm 17.0.14+0
2025-04-28T21:38:49.406Z Maleks-MacBook-Pro.local INFO [org.eclipse.jetty.server.AbstractConnector:333] - Started ServerConnector@76da1984{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
2025-04-28T21:38:49.407Z Maleks-MacBook-Pro.local INFO [org.eclipse.jetty.server.Server:415] - Started @4371ms
2025-04-28T21:38:49.408Z Maleks-MacBook-Pro.local INFO [dvb.server.core:?] - Serving DativeBase HTTP API at http://localhost:8080/.
2025-04-28T21:38:49.408Z Maleks-MacBook-Pro.local INFO [dvb.server.core:?] - Serving DativeBase Swagger UI at http://localhost:8080/swagger-ui/dist/index.html.

New logs:

2025-04-28T22:44:08.264846Z INFO SLF4J Maleks-MacBook-Pro.local com.zaxxer.hikari.HikariDataSource dativebase-pool - Starting...
   data: #:slf4j{:args ["dativebase-pool"]}
2025-04-28T22:44:08.349123Z INFO SLF4J Maleks-MacBook-Pro.local com.zaxxer.hikari.pool.HikariPool dativebase-pool - Added connection org.postgresql.jdbc.PgConnection@c0f3f78
   data: #:slf4j{:args ["dativebase-pool" #object[org.postgresql.jdbc.PgConnection 0xc0f3f78 "org.postgresql.jdbc.PgConnection@c0f3f78"]]}
2025-04-28T22:44:08.351637Z INFO SLF4J Maleks-MacBook-Pro.local com.zaxxer.hikari.HikariDataSource dativebase-pool - Start completed.
   data: #:slf4j{:args ["dativebase-pool"]}
2025-04-28T22:44:08.380758Z INFO SLF4J Maleks-MacBook-Pro.local org.eclipse.jetty.server.Server jetty-9.4.48.v20220622; built: 2022-06-21T20:42:25.880Z; git: 6b67c5719d1f4371b33655ff2d047d24e171e49a; jvm 17.0.14+0
   data: #:slf4j{:args ["9.4.48.v20220622" "2022-06-21T20:42:25.880Z" "6b67c5719d1f4371b33655ff2d047d24e171e49a" "17.0.14+0"]}
2025-04-28T22:44:08.401155Z INFO SLF4J Maleks-MacBook-Pro.local org.eclipse.jetty.server.AbstractConnector Started ServerConnector@7ce6c004{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
   data: #:slf4j{:args [#object[org.eclipse.jetty.server.ServerConnector 0x7ce6c004 "ServerConnector@7ce6c004{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}"]]}
2025-04-28T22:44:08.402032Z INFO SLF4J Maleks-MacBook-Pro.local org.eclipse.jetty.server.Server Started @4633ms
   data: #:slf4j{:args []}
2025-04-28T22:44:08.402376Z INFO LOG Maleks-MacBook-Pro.local dvb.server.core Serving DativeBase HTTP API at http://localhost:8080/.
2025-04-28T22:44:08.403077Z INFO LOG Maleks-MacBook-Pro.local dvb.server.core Serving DativeBase Swagger UI at http://localhost:8080/swagger-ui/dist/index.html.

Ran existing test suite, all tests passed:

╰─ make tests  
2025-05-13T22:04:48.729894Z INFO SLF4J Maleks-MacBook-Pro.local org.eclipse.jetty.util.log Logging initialized @5677ms to org.eclipse.jetty.util.log.Slf4jLog
   data: #:slf4j{:args []}
[(..........)(.....................)(..........)(...........................................................................)(.....................................................................................................)(........................)(..........................................................................................................................................)(...................................................................)(.............)(........)(.............)(.........)(....)(................)(.............................................)(...............)(....................)(....)]
25 tests, 593 assertions, 0 failures.

Note

I left some configuration options for telemere.handler:file commented out in src/dvb/server/system/log.clj. These change log rotation, compression, formatting, etc. These are optional, can be removed if not needed.

@mazadegan mazadegan requested a review from jrwdunham May 13, 2025 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants