How to log from Azure SQL Database

Ayush Shrivastava 0 Reputation points
2024-07-19T12:06:05.94+00:00

Is there a way to log messages in Azure SQL database directly ? similar to what we do with any springboot application ?

log.error or log.info("your message");

Azure SQL Database
{count} votes

1 answer

Sort by: Most helpful
  1. Sina Salam 7,201 Reputation points
    2024-07-19T13:28:33.6933333+00:00

    Hello Ayush Shrivastava,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    Problem

    I understand that you would like to know the way to log messages in Azure SQL database directly which is similar to what you do with any springboot application.

    Solution

    To log messages directly into an Azure SQL Database, you can use several approaches. The approach depends on your application. Few common methods, including using ADO.NET in C#, Entity Framework, and Azure Functions.

    Using ADO.NET in C#

    Connecting to SQL Database with ADO.NET. https://docs.microsoft.com/en-us/azure/sql-database/sql-database-connect-query-dotnet-core

    Execute a Simple Command Using a SqlCommand. https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql/enhanced-sql-command-support

    Using Entity Framework

    Working with Azure SQL Database and EF Core. https://docs.microsoft.com/en-us/azure/sql-database/sql-database-connect-entity-framework-core

    Using Azure Functions

    Use Azure Functions to connect to an Azure SQL Database. https://docs.microsoft.com/en-us/samples/azure-samples/functions-dotnet-mysql-data-access/use-azure-functions-to-connect-to-an-azure-sql-database/

    However, if you would like to be logging messages directly into an Azure SQL Database from a Spring Boot application can be done efficiently using Spring Data JPA.

    References

    Kindly use the provided links above as references for more detail steps.

    Accept Answer

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.

    ** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful ** so that others in the community facing similar issues can easily find the solution.

    Best Regards,

    Sina Salam

    0 comments No comments