Tracing logging is one of the critical part of any application to fix the issue or bugs quickly without spending more time to debug application.
There are so many logging framework for blazor, but i will show one of the most popular framework i.e log4Net. Currently i am using in one of my personal demo project.
These are the following steps to implement in Blazor application.
Step 1. Install this 2 packages in project from Nuget Package like this
Step 2. Go to the startup.cs file and inject this package like this
Step3: Create the log4net.xml in parent folder and write the code like this
<log4net> <appender name="Console" type="log4net.Appender.ConsoleAppender"> <layout type="log4net.Layout.PatternLayout"> <!-- Pattern to output the caller's file name and line number --> <conversionPattern value="%5level [%thread] (%file:%line) - %message%newline" /> </layout> </appender> <appender name="RollingFile" type="log4net.Appender.RollingFileAppender"> <file value="logFiles\CarInspectionLog.log" /> <appendToFile value="true" /> <maximumFileSize value="100KB" /> <maxSizeRollBackups value="2" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%level %thread %logger - %message%newline" /> </layout> </appender> <root> <level value="DEBUG" /> <appender-ref ref="Console" /> <appender-ref ref="RollingFile" /> </root> </log4net>
Step 4: Now use the Log method by using ILogger interface like this
Step 5: Run the application, to see the log message
Sir ,Can you share how to generate the password , show that password as the message popup and save that password along with the other details passing to the database in blazor server app .
Sure, I will write post on this topic. But we donont have to show password as popup in any application. That is not good approach. If somebody forget password then we have to send change password URL to that user email id.