Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion examples/Advanced/advanced_example_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def recursive_get(child_conf: Dict, key_parts: List[str]) -> Any:
# A FastAPI application is initialized providing some test API
# ----------------------------------------------------------------------------------------------------------------------

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("ExampleApp")

# Initialize a connection to the DB which the app is using
Expand Down
1 change: 0 additions & 1 deletion examples/FastAPI/fastapi_example_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from pyctuator.pyctuator import Pyctuator

logging.basicConfig(level=logging.INFO)
my_logger = logging.getLogger("example")

app = FastAPI(
Expand Down
2 changes: 0 additions & 2 deletions examples/Flask/flask_example_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

from pyctuator.pyctuator import Pyctuator

logging.basicConfig(level=logging.INFO)

# Keep the console clear - configure werkzeug (flask's WSGI web app) not to log the detail of every incoming request
logging.getLogger("werkzeug").setLevel(logging.WARNING)

Expand Down
1 change: 0 additions & 1 deletion examples/aiohttp/aiohttp_example_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from pyctuator.pyctuator import Pyctuator

logging.basicConfig(level=logging.INFO)
my_logger = logging.getLogger("example")
app = web.Application()
routes = web.RouteTableDef()
Expand Down
5 changes: 5 additions & 0 deletions pyctuator/pyctuator.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ def __init__(
self.boot_admin_registration_handler: Optional[BootAdminRegistrationHandler] = None

root_logger = logging.getLogger()
# If application did not initiate logging module, add default handler to root logger
# logging.info implicitly calls logging.basicConfig(), see logging.basicConfig in Python's documentation.
if not root_logger.hasHandlers():
logging.info("Logging not configured, using logging.basicConfig()")

root_logger.addHandler(self.pyctuator_impl.logfile.log_messages)

# Find and initialize an integration layer between the web-framework adn pyctuator
Expand Down