How to log exceptions into database using log4net in DXC environment

Vote:
 

Hi Team,

Can anyone please suggest best practices to log errors into database using existing log4net in DXC environment?

As of now, Default DXC environment logging is enabled but i want to override and save to database for better use. so i can also log any DEBUG or information logs as well into database.

#217222
Feb 19, 2020 15:55
Vote:
 

Logging into database is generally not a good idea, especially in managed environments like DXC. if you are logging too much you can bring down your database. Why would you want to log DEBUG/INFO messages to database?

#217223
Feb 19, 2020 16:14
Vote:
 

Hi Quan,

For better accessing the logs i am thinking to go for database. Is there any better way of logging DEBUG/INFO messages into DXC environment? Can you please suggest?

Currently, i have implemented lot of transactional operations apart from regular CMS features. So sometimes i need to log the output of anyone of transaction method to troubleshoot any response.

#217226
Feb 19, 2020 16:43
Vote:
 

Hi Suresh

You can configure Log4net database appender to achieve what you need. As Quan said previously, it's not a good idea and recommended. From memory, the PAAS portal has provided access to Application Log from both stream and csv export. If you have Azure portal access, you can access to application insight as well. 

https://logging.apache.org/log4net/release/config-examples.html

#217249
Feb 20, 2020 3:10
Vote:
 

Hi Vincent,

Yes i am able to access the logs from paasportal. But these are error logs.

As of now it is only logging errors. Is there any way of logging any DEBUG/INFO logs into DXC environment?

#217269
Feb 20, 2020 3:57
Vote:
 

I believe you can set the logging level, as well as connect to the logging stream for such information https://world.episerver.com/digital-experience-cloud-service/development-considerations/logging/

#217273
Feb 20, 2020 6:32
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.