File tree Expand file tree Collapse file tree 4 files changed +34
-19
lines changed
Expand file tree Collapse file tree 4 files changed +34
-19
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,17 @@ def __init__(
7070 schema : Optional [str ],
7171 debug_mode : bool = False ,
7272 ):
73+ # Log application database connection information
74+ printable_url = sa .make_url (database_url ).render_as_string (hide_password = True )
75+ dbos_logger .info (
76+ f"Initializing DBOS application database with URL: { printable_url } "
77+ )
78+ if not database_url .startswith ("sqlite" ):
79+ dbos_logger .info (
80+ f"DBOS application database engine parameters: { engine_kwargs } "
81+ )
82+
83+ # Configure and initialize the application database
7384 if database_url .startswith ("sqlite" ):
7485 self .schema = None
7586 else :
Original file line number Diff line number Diff line change @@ -408,25 +408,6 @@ def process_config(
408408
409409 configure_db_engine_parameters (data ["database" ], connect_timeout = connect_timeout )
410410
411- assert data ["system_database_url" ] is not None
412- # Pretty-print connection information, respecting log level
413- if not silent and logs ["logLevel" ] == "INFO" or logs ["logLevel" ] == "DEBUG" :
414- printable_sys_db_url = make_url (data ["system_database_url" ]).render_as_string (
415- hide_password = True
416- )
417- print (f"DBOS system database URL: { printable_sys_db_url } " )
418- if data ["database_url" ]:
419- printable_app_db_url = make_url (data ["database_url" ]).render_as_string (
420- hide_password = True
421- )
422- print (f"DBOS application database URL: { printable_app_db_url } " )
423- if data ["system_database_url" ].startswith ("sqlite" ):
424- print (
425- f"Using SQLite as a system database. The SQLite system database is for development and testing. PostgreSQL is recommended for production use."
426- )
427- else :
428- print (f"Database engine parameters: { data ['database' ]['db_engine_kwargs' ]} " )
429-
430411 # Return data as ConfigFile type
431412 return data
432413
Original file line number Diff line number Diff line change @@ -405,6 +405,26 @@ def __init__(
405405 import sqlalchemy .dialects .postgresql as pg
406406 import sqlalchemy .dialects .sqlite as sq
407407
408+ # Log system database connection information
409+ if engine :
410+ dbos_logger .info ("Initializing DBOS system database with custom engine" )
411+ else :
412+ printable_sys_db_url = sa .make_url (system_database_url ).render_as_string (
413+ hide_password = True
414+ )
415+ dbos_logger .info (
416+ f"Initializing DBOS system database with URL: { printable_sys_db_url } "
417+ )
418+ if system_database_url .startswith ("sqlite" ):
419+ dbos_logger .info (
420+ f"Using SQLite as a system database. The SQLite system database is for development and testing. PostgreSQL is recommended for production use."
421+ )
422+ else :
423+ dbos_logger .info (
424+ f"DBOS system database engine parameters: { engine_kwargs } "
425+ )
426+
427+ # Configure and initialize the system database
408428 self .dialect = sq if system_database_url .startswith ("sqlite" ) else pg
409429
410430 self .serializer = serializer
Original file line number Diff line number Diff line change 11import json
2+ import logging
23import os
34import platform
45import signal
2425 load_config ,
2526)
2627from .._docker_pg_helper import start_docker_pg , stop_docker_pg
28+ from .._logger import dbos_logger
2729from .._sys_db import SystemDatabase
2830from .._utils import GlobalParams
2931from ..cli ._github_init import create_template_from_github
@@ -48,6 +50,7 @@ def _get_db_url(
4850 Otherwise fallback to the same SQLite Postgres URL than the DBOS library.
4951 Note that for the latter to be possible, a configuration file must have been found, with an application name set.
5052 """
53+ dbos_logger .setLevel (logging .WARNING ) # The CLI should not emit INFO logs
5154 if os .environ .get ("DBOS__CLOUD" ) == "true" :
5255 system_database_url = os .environ .get ("DBOS_SYSTEM_DATABASE_URL" )
5356 application_database_url = os .environ .get ("DBOS_DATABASE_URL" )
You can’t perform that action at this time.
0 commit comments